Package org.beanio.types
Interface TypeHandler
-
- All Known Subinterfaces:
ConfigurableTypeHandler
- All Known Implementing Classes:
AbstractXmlCalendarTypeHandler,AbstractXmlDateTypeHandler,BigDecimalTypeHandler,BigIntegerTypeHandler,BooleanTypeHandler,ByteTypeHandler,CalendarTypeHandler,CharacterTypeHandler,DateTypeHandler,DateTypeHandlerSupport,DoubleTypeHandler,EnumTypeHandler,FloatTypeHandler,IntegerTypeHandler,LongTypeHandler,NumberTypeHandler,ShortTypeHandler,StringTypeHandler,TemporalAccessorTypeHandler,ToStringEnumTypeHandler,URLTypeHandler,UUIDTypeHandler,XmlBooleanTypeHandler,XmlCalendarDateTimeTypeHandler,XmlCalendarDateTypeHandler,XmlCalendarTimeTypeHandler,XmlDateTimeTypeHandler,XmlDateTypeHandler,XmlTimeTypeHandler
public interface TypeHandlerATypeHandleris used to convert field text into a Java object and vice versa.Implementations should be thread-safe if multiple threads may concurrently process the same stream type. All included BeanIO type handlers are thread safe.
- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNILThis constant can be returned fromformat(Object)for XML formatted streams to indicate a nillable element should be set to nil even if the field's minimum occurrences is zero.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Stringformat(java.lang.Object value)Formats a Java object into field text.java.lang.Class<?>getType()Returns the class type supported by this handler.java.lang.Objectparse(java.lang.String text)Parses field text into a Java object.
-
-
-
Field Detail
-
NIL
static final java.lang.String NIL
This constant can be returned fromformat(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 asnull.
-
-
Method Detail
-
parse
java.lang.Object parse(java.lang.String text) throws TypeConversionExceptionParses field text into a Java object.- Parameters:
text- the field text to parse, which may be null if the field was not passed in the record- Returns:
- the parsed Java object
- Throws:
TypeConversionException- if the text cannot be parsed
-
format
java.lang.String format(java.lang.Object value)
Formats a Java object into field text.- Parameters:
value- the Java object to format, which may be null- Returns:
- the formatted field text, or
nullto indicate the value is not present, orNILfor XML formatted streams
-
getType
java.lang.Class<?> getType()
Returns the class type supported by this handler. Primitive types should not be returned by this method- use the object equivalent instead.- Returns:
- the class type supported by this handler
-
-