public abstract class AbstractXmlCalendarTypeHandler extends CalendarTypeHandler
Calendar
type handlers based on the W3C XML Schema
datatype specification.Modifier and Type | Field and Description |
---|---|
protected static DatatypeFactory |
dataTypeFactory |
lenient, pattern, timeZone
locale
FORMAT_SETTING
NIL
Constructor and Description |
---|
AbstractXmlCalendarTypeHandler()
Constructs a new AbstractXmlDateTypeHandler.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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).
|
Calendar |
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.
|
formatCalendar, getType
createDateFormat, createDefaultDateFormat, formatDate, getPattern, getTimeZone, getTimeZoneId, isLenient, newInstance, parseDate, setLenient, setPattern, setTimeZoneId
getLocale, setLocale
protected static final DatatypeFactory dataTypeFactory
public AbstractXmlCalendarTypeHandler()
public Calendar parse(String text) throws TypeConversionException
TypeHandler
parse
in interface TypeHandler
parse
in class CalendarTypeHandler
text
- the field text to parse, which may be null if the field was not passed in the recordTypeConversionException
- if the text cannot be parsedpublic abstract String format(Object value)
TypeHandler
format
in interface TypeHandler
format
in class CalendarTypeHandler
value
- the Java object to format, which may be nullTypeHandler.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 offsetDatatypeConstants.FIELD_UNDEFINED
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