T - The type of object this parser generates from string valuespublic interface ValueParser<T> extends ValueFormatter<T>
An interface that denotes the implementing object is capable of converting between strings and objects of a certain type. Along with the constraints applied by this interface, all classes implementing this interface must define a no-argument constructor which properly constructs the parser. If no actual configuration is required, a constructor may be omitted entirely and the objects default constructor provided automatically by Java will be used instead.
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
format(T 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.
|
java.lang.Class<T> getType()
Class of object this ValueParser can handle.
The 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>ValueParserT parse(java.lang.String valueString) throws ValueParseException
ValueParseException - If valueString is not of a format that allows this
parser to convert it into an object of type TvalueString - The string to parsevalueStringjava.lang.String format(T value)
format in interface ValueFormatter<T>value -