public interface TypeHandler
Implementations should be thread-safe if multiple threads may concurrently process the same stream type. All included BeanIO type handlers are thread safe.
Modifier and Type | Field and Description |
---|---|
static String |
NIL
This constant can be returned from
format(Object) for XML formatted streams to indicate
a nillable element should be set to nil even if the field's minimum occurrences is zero. |
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.
|
static final String NIL
format(Object)
for XML formatted streams to indicate
a nillable element should be set to nil even if the field's minimum occurrences is zero.
In all other cases, if NIL is returned, the formatted value is treated as null.Object parse(String text) throws TypeConversionException
text
- the field text to parse, which may be null if the field was not passed in the recordTypeConversionException
- if the text cannot be parsedString format(Object value)
value
- the Java object to format, which may be nullNIL
for XML formatted streamsClass<?> getType()