T - target typepublic class DefaultFormatter<T> extends java.lang.Object implements ValueParser<T>
ReferenceValueParser| Constructor and Description |
|---|
DefaultFormatter(java.lang.Class<T> clazz) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
format(java.lang.Object value)
Format a value as a string.
|
java.lang.Class<T> |
getType()
Returns the
Class of object this ValueParser can handle. |
T |
parse(java.lang.String valueString)
Parses the specified string and constructs the appropriate object out of
it.
|
public DefaultFormatter(java.lang.Class<T> clazz)
public java.lang.Class<T> getType()
ValueParserClass of object this ValueParser can handle.
The ValueParser.parse(String) method must return objects that are assignable to this type.
The #format(T) method can format any object assignable to this type.
The returned class will be the
exact Class (i.e. not a subclass) of this
ValueParser's typegetType in interface ValueFormatter<T>getType in interface ValueParser<T>ValueParserpublic T parse(java.lang.String valueString) throws ValueParseException
ValueParserparse in interface ValueParser<T>ValueParseException - If valueString is not of a format that allows this
parser to convert it into an object of type TvalueString - The string to parsevalueStringpublic java.lang.String format(java.lang.Object value)
ValueParserformat in interface ValueFormatter<T>format in interface ValueParser<T>value - The object to format