Interface TypeWrapper
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractSimpleTypeWrapper,BooleanTypeWrapper,ColorTypeWrapper,EnumTypeWrapper,NumberTypeWrapper,StringTypeWrapper,TLIListTypeWrapper
Encapsulates information about a parameter's value type and how values
should be converted between strings and the appropriate object instances.
This allows elimination of an additional "evil" if-elseif...else" pattern.
- Version:
- $Revision: 03dc0884e86f $
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionfromString(String value) Attempts to convert a parameter value expressed as string into an instance of the appropriate (for this parameter) type.Class<?> Attempts to convert a parameter value expressed as an object of the appropriate (for this parameter) type into a string representation.booleanChecks if the object is of a valid type for this type info.
-
Field Details
-
FAILED_TO_CONVERT
Error message for failed to convert 1/2.- See Also:
-
TO
Error message for failed to convert 2/2.- See Also:
-
-
Method Details
-
getValueType
Class<?> getValueType()- Returns:
- the class instance being wrapped
-
valid
Checks if the object is of a valid type for this type info.- Parameters:
o- the object to check- Returns:
- true if the parameter can be set.
-
fromString
Attempts to convert a parameter value expressed as string into an instance of the appropriate (for this parameter) type.- Parameters:
value- parameter value as string- Returns:
- parameter value as an instance of the proper type
-
toString
Attempts to convert a parameter value expressed as an object of the appropriate (for this parameter) type into a string representation.- Parameters:
value- parameter value as object- Returns:
- parameter value as string
-