org.exolab.castor.xml.handlers
public class DateFieldHandler extends XMLFieldHandler
Version: $Revision: 6230 $ $Date: 2005-02-09 13:04:19 -0700 (Wed, 09 Feb 2005) $
Nested Class Summary | |
---|---|
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(Object obj)
Returns true if the given object is an XMLFieldHandler that
is equivalent to the delegated handler. |
protected static String | format(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.
|
Object | getValue(Object target)
Returns the value of the field associated with this
descriptor from the given target object. |
Object | newInstance(Object parent)
Creates a new instance of the object described by this field.
|
protected static Date | parse(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 Date | parse(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(Object target) |
static void | setAllowTimeZoneSuppression(boolean allowTimeZoneSuppression)
Sets whether or not UTC time should always be used when
marshalling out xsd:dateTime values. |
static void | setDefaultTimeZone(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(Object target, Object value)
Sets the value of the field associated with this descriptor. |
Parameters: fieldHandler the fieldHandler for delegation.
Returns: true if the given object is an XMLFieldHandler that is equivalent to this one.
Parameters: date the Date to format
Returns: the formatted string
Parameters: target the object to get the value from
Returns: the value of the field associated with this descriptor from the given target object.
Parameters: parent The object for which the field is created
Returns: A new instance of the field's value
Throws: IllegalStateException This field is a simple type and cannot be instantiated
Parameters: dateTime the string to convert to a Date
Returns: a new Date that represents the given string.
Throws: ParseException when the given string does not conform to the above string.
Parameters: dateTime the string to convert to a Date
Returns: a new Date that represents the given string.
Throws: ParseException when the given string does not conform to the above string.
Parameters: timeZone TimeZone to use instead of JVM default
See Also: DateFieldHandler
Parameters: suppressMillis a boolean when true indicates that millis should be suppressed during conversion of a dateTime to a String
Parameters: useSQLDate a boolean that when true indicates that java.sql.Date should be used instead of java.util.Date.
Parameters: target the object in which to set the value value the value of the field