|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.types.DateTypeHandler org.beanio.types.xml.AbstractXmlDateTypeHandler
public abstract class AbstractXmlDateTypeHandler
Base class for java.util.Date type handlers based on the W3C XML Schema datatype specification.
Field Summary | |
---|---|
protected static DatatypeFactory |
dataTypeFactory
|
Fields inherited from interface org.beanio.types.ConfigurableTypeHandler |
---|
FORMAT_SETTING |
Fields inherited from interface org.beanio.types.TypeHandler |
---|
NIL |
Constructor Summary | |
---|---|
AbstractXmlDateTypeHandler()
Constructs a new AbstractXmlDateTypeHandler. |
Method Summary | |
---|---|
abstract String |
format(Object value)
Formats a Java object into field text. |
protected abstract QName |
getDatatypeQName()
Returns the expected XML Schema data type when parse is called. |
String |
getTimeZoneId()
Returns the time zone used to interpret dates, or null if the default time zone will be used. |
protected int |
getTimeZoneOffset(Date date)
Returns the time zone offset in minutes for the given date, or DatatypeConstants.FIELD_UNDEFINED if a time zone was not configured. |
boolean |
isLenientDatatype()
Returns whether data type validation is skipped when parsing field text. |
boolean |
isTimeZoneAllowed()
Returns whether time zone information is allowed when parsing field text. |
protected Calendar |
newCalendar()
Creates a new calendar using the configured time zone (if set). |
Date |
parse(String text)
Parses field text into a Java object. |
void |
setLenientDatatype(boolean lenientDatatype)
Sets whether data type validation is skipped when parsing field text. |
void |
setTimeZoneAllowed(boolean timeZoneAllowed)
Sets whether time zone information is allowed when parsing field text. |
void |
setTimeZoneId(String name)
Sets the time zone for interpreting dates. |
Methods inherited from class org.beanio.types.DateTypeHandler |
---|
createDateFormat, createDefaultDateFormat, getPattern, getType, isLenient, newInstance, setLenient, setPattern |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final DatatypeFactory dataTypeFactory
Constructor Detail |
---|
public AbstractXmlDateTypeHandler()
Method Detail |
---|
public Date parse(String text) throws TypeConversionException
TypeHandler
parse
in interface TypeHandler
parse
in class DateTypeHandler
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 abstract String format(Object value)
TypeHandler
format
in interface TypeHandler
format
in class DateTypeHandler
value
- the Java object to format, which may be null
TypeHandler.NIL
for XML formatted streamsprotected abstract QName getDatatypeQName()
protected Calendar newCalendar()
protected int getTimeZoneOffset(Date date)
DatatypeConstants.FIELD_UNDEFINED
if a time zone was not configured.
date
- the date on which to determine the time zone offset
DatatypeConstants.FIELD_UNDEFINED
public void setTimeZoneId(String name)
name
- the time zone IDTimeZone
public String getTimeZoneId()
TimeZone
public boolean isTimeZoneAllowed()
public void setTimeZoneAllowed(boolean timeZoneAllowed)
timeZoneAllowed
- true if time zone information is allowed when
parsing field textpublic boolean isLenientDatatype()
public void setLenientDatatype(boolean lenientDatatype)
lenientDatatype
- true if data type validation is skipped
|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |