|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.chwf.converter.Converter
Converter class. It is the superclass for more specific converters.
Constructor Summary | |
protected |
Converter()
No-op constructor. |
Method Summary | |
static java.lang.String |
convert(java.lang.Object object)
Utility method that converts the object to a string using the converter for its class. |
abstract java.lang.String |
format(java.lang.Object value)
Format the conversion type as a string. |
static Converter |
getConverter(java.lang.Class type)
Factory method that gets the converter for the given data type. |
static Converter |
getConverter(java.lang.String type)
Factory method that gets the converter for the given data type. |
java.lang.String |
getType()
The converter's datatype, or null if the type is unknown. |
boolean |
isSimpleType()
Returns true if the converted type is simple. |
abstract java.lang.Object |
parse(java.lang.String value)
Parse the string value to the conversion type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Converter()
Method Detail |
public static Converter getConverter(java.lang.Class type)
DefaultConverter
.type
- The class being converted.public static Converter getConverter(java.lang.String type)
DefaultConverter
.type
- The datatype being converted.public static java.lang.String convert(java.lang.Object object)
object
- The object.public abstract java.lang.Object parse(java.lang.String value) throws ConversionException
value
- The value being parsed.ConversionException
- If parsing fails.public abstract java.lang.String format(java.lang.Object value)
value
- The value being format.public java.lang.String getType()
null
if the type is unknown.public boolean isSimpleType()
parse()
method will not function. Any type that
uses the DefaultConverter
is by definition not simple.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |