net.sourceforge.jeuclid.context.typewrapper
Class AbstractSimpleTypeWrapper
java.lang.Object
net.sourceforge.jeuclid.context.typewrapper.AbstractSimpleTypeWrapper
- All Implemented Interfaces:
- Serializable, TypeWrapper
- Direct Known Subclasses:
- BooleanTypeWrapper, ColorTypeWrapper, EnumTypeWrapper, NumberTypeWrapper, StringTypeWrapper, TLIListTypeWrapper
public abstract class AbstractSimpleTypeWrapper
- extends 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
Method Summary |
Object |
fromString(String value)
Attempts to convert a parameter value expressed as string into an
instance of the appropriate (for this parameter) type. |
Class<?> |
getValueType()
|
String |
toString(Object value)
Attempts to convert a parameter value expressed as an object of the
appropriate (for this parameter) type into a string representation. |
boolean |
valid(Object o)
Checks if the object is of a valid type for this type info. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractSimpleTypeWrapper
protected AbstractSimpleTypeWrapper(Class<?> valType)
- Parameters:
valType
- a Class object
getValueType
public Class<?> getValueType()
-
- Specified by:
getValueType
in interface TypeWrapper
- Returns:
- the class instance being wrapped
valid
public boolean valid(Object o)
- Checks if the object is of a valid type for this type info.
- Specified by:
valid
in interface TypeWrapper
- Parameters:
o
- the object to check
- Returns:
- true if the parameter can be set.
fromString
public Object fromString(String value)
- Attempts to convert a parameter value expressed as string into an
instance of the appropriate (for this parameter) type.
- Specified by:
fromString
in interface TypeWrapper
- Parameters:
value
- parameter value as string
- Returns:
- parameter value as an instance of the proper type
toString
public String toString(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:
toString
in interface TypeWrapper
- Parameters:
value
- parameter value as object
- Returns:
- parameter value as string
Copyright © 2002-2010 The JEuclid project. All Rights Reserved.