|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.mapping.loader.FieldHandlerFriend
org.exolab.castor.mapping.ExtendedFieldHandler
org.exolab.castor.mapping.AbstractFieldHandler
org.exolab.castor.xml.XMLFieldHandler
org.exolab.castor.xml.handlers.DateFieldHandler
public class DateFieldHandler
A specialized FieldHandler for the XML Schema Date/Time related types
Nested Class Summary | |
---|---|
(package private) static class |
DateFieldHandler.ParseOptions
A class for controlling the parse options |
Constructor Summary | |
---|---|
DateFieldHandler(FieldHandler fieldHandler)
Creates a new DateFieldHandler using the given FieldHandler for delegation. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Returns true if the given object is an XMLFieldHandler that is equivalent to the delegated handler. |
protected static java.lang.String |
format(java.util.Date date)
Returns the given date in a String format, using the ISO8601 format as specified in the W3C XML Schema 1.0 Recommendation (Part 2: Datatypes) for dataTime. |
java.lang.Object |
getValue(java.lang.Object target)
Returns the value of the field associated with this descriptor from the given target object. |
java.lang.Object |
newInstance(java.lang.Object parent)
Creates a new instance of the object described by this field. |
protected static java.util.Date |
parse(java.lang.String dateTime)
Parses the given string, which must be in the following format: CCYY-MM-DDThh:mm:ss or CCYY-MM-DDThh:mm:ss.sss where "CC" represents the century, "YY" the year, "MM" the month and "DD" the day. |
protected static java.util.Date |
parse(java.lang.String dateTime,
DateFieldHandler.ParseOptions options)
Parses the given string, which must be in the following format: CCYY-MM-DDThh:mm:ss or CCYY-MM-DDThh:mm:ss.sss where "CC" represents the century, "YY" the year, "MM" the month and "DD" the day. |
void |
resetValue(java.lang.Object target)
Sets the value of the field to a default value. |
static void |
setAllowTimeZoneSuppression(boolean allowTimeZoneSuppression)
Sets whether or not UTC time should always be used when marshalling out xsd:dateTime values. |
static void |
setDefaultTimeZone(java.util.TimeZone timeZone)
Sets the default TimeZone used for comparing dates when marshalling out xsd:dateTime values using this handler. |
static void |
setSuppressMillis(boolean suppressMillis)
Sets a flag indicating whether or not Milliseconds should be suppressed upon formatting a dateTime as a String |
void |
setUseSQLDate(boolean useSQLDate)
Specifies that this DateFieldHandler should use java.sql.Date when creating new Date instances. |
void |
setValue(java.lang.Object target,
java.lang.Object value)
Sets the value of the field associated with this descriptor. |
Methods inherited from class org.exolab.castor.xml.XMLFieldHandler |
---|
newInstance |
Methods inherited from class org.exolab.castor.mapping.AbstractFieldHandler |
---|
getFieldDescriptor, hasValue, setFieldDescriptor |
Methods inherited from class org.exolab.castor.mapping.ExtendedFieldHandler |
---|
checkValidity |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateFieldHandler(FieldHandler fieldHandler)
fieldHandler
- the fieldHandler for delegation.Method Detail |
---|
public java.lang.Object getValue(java.lang.Object target) throws java.lang.IllegalStateException
getValue
in interface FieldHandler
getValue
in class XMLFieldHandler
target
- the object to get the value from
java.lang.IllegalStateException
- The Java object has changed and
is no longer supported by this handler, or the handler is not
compatiable with the Java objectpublic void setValue(java.lang.Object target, java.lang.Object value) throws java.lang.IllegalStateException
setValue
in interface FieldHandler
setValue
in class XMLFieldHandler
target
- the object in which to set the valuevalue
- the value of the field
java.lang.IllegalStateException
- The Java object has changed and
is no longer supported by this handler, or the handler is not
compatiable with the Java objectpublic void resetValue(java.lang.Object target) throws java.lang.IllegalStateException
AbstractFieldHandler
Reference fields are set to null, primitive fields are set to their default value, collection fields are emptied of all elements.
resetValue
in interface FieldHandler
resetValue
in class XMLFieldHandler
target
- The object
java.lang.IllegalStateException
- The Java object has changed and
is no longer supported by this handler, or the handler is not
compatiable with the Java objectpublic java.lang.Object newInstance(java.lang.Object parent) throws java.lang.IllegalStateException
newInstance
in interface FieldHandler
newInstance
in class XMLFieldHandler
parent
- The object for which the field is created
java.lang.IllegalStateException
- This field is a simple type and
cannot be instantiatedpublic boolean equals(java.lang.Object obj)
equals
in class XMLFieldHandler
public static void setAllowTimeZoneSuppression(boolean allowTimeZoneSuppression)
public static void setDefaultTimeZone(java.util.TimeZone timeZone)
timeZone
- TimeZone to use instead of JVM defaultsetAllowTimeZoneSuppression
public static void setSuppressMillis(boolean suppressMillis)
suppressMills
- a boolean when true indicates that millis
should be suppressed during conversion of a dateTime to a Stringpublic void setUseSQLDate(boolean useSQLDate)
useSQLDate
- a boolean that when true indicates
that java.sql.Date should be used instead of java.util.Date.protected static java.util.Date parse(java.lang.String dateTime) throws java.text.ParseException
dateTime
- the string to convert to a Date
java.text.ParseException
- when the given string does not conform
to the above string.protected static java.util.Date parse(java.lang.String dateTime, DateFieldHandler.ParseOptions options) throws java.text.ParseException
dateTime
- the string to convert to a Date
java.text.ParseException
- when the given string does not conform
to the above string.protected static java.lang.String format(java.util.Date date)
date
- the Date to format
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |