|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.internal.util.EnumTypeHandler
public class EnumTypeHandler
Default Enum
type handler that uses Enum.valueOf(Class, String)
to parse a value and Enum.name()
to format a value.
Field Summary |
---|
Fields inherited from interface org.beanio.types.TypeHandler |
---|
NIL |
Constructor Summary | |
---|---|
EnumTypeHandler(Class<Enum> type)
Constructs a new EnumTypeHandler. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnumTypeHandler(Class<Enum> type)
type
- the Enum classMethod Detail |
---|
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 record
TypeConversionException
- if the text cannot be parsedpublic String format(Object value)
TypeHandler
format
in interface TypeHandler
value
- the Java object to format, which may be null
TypeHandler.NIL
for XML formatted streamspublic Class<?> getType()
TypeHandler
getType
in interface TypeHandler
|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |