Class AbstractSimpleTypeWrapper
- java.lang.Object
-
- net.sourceforge.jeuclid.context.typewrapper.AbstractSimpleTypeWrapper
-
- All Implemented Interfaces:
java.io.Serializable,TypeWrapper
- Direct Known Subclasses:
BooleanTypeWrapper,ColorTypeWrapper,EnumTypeWrapper,NumberTypeWrapper,StringTypeWrapper,TLIListTypeWrapper
public abstract class AbstractSimpleTypeWrapper extends java.lang.Object implements TypeWrapper
Basic (and simple) implementation of TypeWrapper. Maintains an instance of type being wrapped as well as provides reasonable default implementations for all the operations.- Version:
- $Revision: 03dc0884e86f $
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface net.sourceforge.jeuclid.context.typewrapper.TypeWrapper
FAILED_TO_CONVERT, TO
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSimpleTypeWrapper(java.lang.Class<?> valType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectfromString(java.lang.String value)Attempts to convert a parameter value expressed as string into an instance of the appropriate (for this parameter) type.java.lang.Class<?>getValueType()java.lang.StringtoString(java.lang.Object value)Attempts to convert a parameter value expressed as an object of the appropriate (for this parameter) type into a string representation.booleanvalid(java.lang.Object o)Checks if the object is of a valid type for this type info.
-
-
-
Method Detail
-
getValueType
public java.lang.Class<?> getValueType()
- Specified by:
getValueTypein interfaceTypeWrapper- Returns:
- the class instance being wrapped
-
valid
public boolean valid(java.lang.Object o)
Checks if the object is of a valid type for this type info.- Specified by:
validin interfaceTypeWrapper- Parameters:
o- the object to check- Returns:
- true if the parameter can be set.
-
fromString
public java.lang.Object fromString(java.lang.String value)
Attempts to convert a parameter value expressed as string into an instance of the appropriate (for this parameter) type.- Specified by:
fromStringin interfaceTypeWrapper- Parameters:
value- parameter value as string- Returns:
- parameter value as an instance of the proper type
-
toString
public java.lang.String toString(java.lang.Object value)
Attempts to convert a parameter value expressed as an object of the appropriate (for this parameter) type into a string representation.- Specified by:
toStringin interfaceTypeWrapper- Parameters:
value- parameter value as object- Returns:
- parameter value as string
-
-