public class ToStringEnumTypeHandler extends Object implements TypeHandler
Enum
type handler that uses Enum.toString()
to parse and format Enum values.NIL
Constructor and Description |
---|
ToStringEnumTypeHandler(Class<Enum> type)
Constructs a new ToStringEnumTypeHandler.
|
Modifier and Type | Method and Description |
---|---|
String |
format(Object value)
Formats a Java object into field text.
|
Class<?> |
getType()
Returns the class type supported by this handler.
|
Object |
parse(String text)
Parses field text into a Java object.
|
public Object parse(String text) throws TypeConversionException
TypeHandler
parse
in interface TypeHandler
text
- the field text to parse, which may be null if the field was not passed in the recordTypeConversionException
- if the text cannot be parsedpublic String format(Object value)
TypeHandler
format
in interface TypeHandler
value
- the Java object to format, which may be nullTypeHandler.NIL
for XML formatted streamspublic Class<?> getType()
TypeHandler
getType
in interface TypeHandler