org.dasein.attributes.types
Class NameValuePairFactory.NameValuePairAttribute
java.lang.Object
org.dasein.attributes.DataType<NameValuePair>
org.dasein.attributes.types.NameValuePairFactory.NameValuePairAttribute
- All Implemented Interfaces:
- Serializable
- Enclosing class:
- NameValuePairFactory
public static class NameValuePairFactory.NameValuePairAttribute
- extends DataType<NameValuePair>
- See Also:
- Serialized Form
NameValuePairFactory.NameValuePairAttribute
public NameValuePairFactory.NameValuePairAttribute(boolean ml,
boolean mv,
boolean req)
getChoices
public Collection<NameValuePair> getChoices()
- Description copied from class:
DataType
- Provides a list of values considered valid for this data type. If any object of the type
governed by this data type is allowed, this method will return
null.
- Specified by:
getChoices in class DataType<NameValuePair>
- Returns:
- a list of allowed values or
null to allow any value
getFactory
public DataTypeFactory<NameValuePair> getFactory()
- Specified by:
getFactory in class DataType<NameValuePair>
- Returns:
- the factory object that owns this data type
getInputType
public DataType.InputType getInputType()
- Specified by:
getInputType in class DataType<NameValuePair>
- Returns:
- the type of input that a user interface should provide to prompt a user for
a value
getValue
public NameValuePair getValue(Object val)
- Description copied from class:
DataType
- Implementors will implement this method to convert a raw value into a valid value of
this data type. Implementations should throw an
InvalidAttributeException if
they are unable to interpret the raw value.
- Specified by:
getValue in class DataType<NameValuePair>
- Parameters:
val - the raw value, such as user input or a string from a persistent store
- Returns:
- a converted value of this data type
isValidChoice
public boolean isValidChoice(NameValuePair pair)
- Description copied from class:
DataType
Checks the specified value to see if it is valid for this data type. In general,
implementing classes will check the following:
- that the value is not required in the instance of a
null value
- that the value is a member of the choices provided by
DataType.getChoices()
- any other criteria an implementor might want to validate
- Specified by:
isValidChoice in class DataType<NameValuePair>
- Parameters:
pair - the value being validated
- Returns:
- true if the value is valid for this data type
toString
public String toString()
- Overrides:
toString in class DataType<NameValuePair>
- Returns:
- a string representation of this data type