Package org.beanio.types
Class TemporalAccessorTypeHandler
- java.lang.Object
-
- org.beanio.types.TemporalAccessorTypeHandler
-
- All Implemented Interfaces:
ConfigurableTypeHandler,TypeHandler
public class TemporalAccessorTypeHandler extends java.lang.Object implements ConfigurableTypeHandler
This type handler can parse/formatTemporalAccessors likeLocalDateTimeorZonedDateTimeusing aDateTimeFormatter.
-
-
Field Summary
-
Fields inherited from interface org.beanio.types.ConfigurableTypeHandler
FORMAT_SETTING
-
Fields inherited from interface org.beanio.types.TypeHandler
NIL
-
-
Constructor Summary
Constructors Constructor Description TemporalAccessorTypeHandler()TemporalAccessorTypeHandler(java.lang.Class<?> type, java.time.format.DateTimeFormatter formatter)
-
Method Summary
All Methods Instance Methods Concrete 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.booleanisStrict()TypeHandlernewInstance(java.util.Properties properties)Creates a customized instance of this type handler.java.time.temporal.TemporalAccessorparse(java.lang.String text)Parses field text into a Java object.voidsetStrict(boolean strict)voidsetTypeName(java.lang.String typeName)Used in custom type handlers defined in XML configurations to specify the actual subclass ofTemporalAccessorto handle.
-
-
-
Method Detail
-
newInstance
public TypeHandler newInstance(java.util.Properties properties)
Description copied from interface:ConfigurableTypeHandlerCreates a customized instance of this type handler.- Specified by:
newInstancein interfaceConfigurableTypeHandler- Parameters:
properties- the properties for customizing the instance- Returns:
- the new
TypeHandler
-
parse
public java.time.temporal.TemporalAccessor parse(java.lang.String text) throws TypeConversionExceptionDescription copied from interface:TypeHandlerParses field text into a Java object.- Specified by:
parsein interfaceTypeHandler- 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
public java.lang.String format(java.lang.Object value)
Description copied from interface:TypeHandlerFormats a Java object into field text.- Specified by:
formatin interfaceTypeHandler- Parameters:
value- the Java object to format, which may be null- Returns:
- the formatted field text, or
nullto indicate the value is not present, orTypeHandler.NILfor XML formatted streams
-
setTypeName
public void setTypeName(java.lang.String typeName) throws java.lang.ClassNotFoundExceptionUsed in custom type handlers defined in XML configurations to specify the actual subclass ofTemporalAccessorto handle.- Throws:
java.lang.ClassNotFoundException
-
getType
public java.lang.Class<?> getType()
Description copied from interface:TypeHandlerReturns the class type supported by this handler. Primitive types should not be returned by this method- use the object equivalent instead.- Specified by:
getTypein interfaceTypeHandler- Returns:
- the class type supported by this handler
-
isStrict
public boolean isStrict()
-
setStrict
public void setStrict(boolean strict)
-
-