|
||||||||||
| 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.
| Field Summary |
|---|
| Fields inherited from class org.exolab.castor.mapping.AbstractFieldHandler |
|---|
_properties |
| 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 dateTime. |
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,
org.exolab.castor.xml.handlers.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)
Sets the value of the field to a default value. |
static void |
setAllowTimeZoneSuppression(boolean allowTimeZoneSuppression)
Sets whether or not the time zone should always be displayed when marshaling xsd:dateTime values. |
static void |
setDefaultTimeZone(TimeZone timeZone)
Sets the default TimeZone used for comparing dates when marshaling 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. |
| Methods inherited from class org.exolab.castor.xml.XMLFieldHandler |
|---|
newInstance |
| Methods inherited from class org.exolab.castor.mapping.AbstractFieldHandler |
|---|
getFieldDescriptor, hasValue, setConfiguration, 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 |
| Methods inherited from interface org.exolab.castor.mapping.FieldHandler |
|---|
checkValidity |
| Constructor Detail |
|---|
public DateFieldHandler(FieldHandler fieldHandler)
fieldHandler - the fieldHandler for delegation.| Method Detail |
|---|
public Object getValue(Object target)
getValue in interface FieldHandlergetValue in class XMLFieldHandlertarget - the object to get the value from
public void setValue(Object target,
Object value)
throws IllegalStateException
setValue in interface FieldHandlersetValue in class XMLFieldHandlertarget - the object in which to set the valuevalue - the value of the field
IllegalStateException - if the value provided cannot be parsed into
a legal date/time.
public void resetValue(Object target)
throws IllegalStateException
resetValue in interface FieldHandlerresetValue in class XMLFieldHandlertarget - The object
IllegalStateException - The Java object has changed and is no
longer supported by this handler, or the handler is not
compatiable with the Java object
public Object newInstance(Object parent)
throws IllegalStateException
newInstance in interface FieldHandlernewInstance in class XMLFieldHandlerparent - The object for which the field is created
IllegalStateException - This field is a simple type and cannot be
instantiatedpublic boolean equals(Object obj)
equals in class XMLFieldHandlerobj - The object to compare against this
public static void setAllowTimeZoneSuppression(boolean allowTimeZoneSuppression)
allowTimeZoneSuppression - if true, the time zone will not be
displayed if it is the current local time zone.public static void setDefaultTimeZone(TimeZone timeZone)
timeZone - TimeZone to use instead of JVM defaultsetAllowTimeZoneSuppression(boolean)public static void setSuppressMillis(boolean suppressMillis)
suppressMillis - 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 Date parse(String dateTime)
throws ParseException
CCYY represents the Year and each 'C' and 'Y' must be a digit from 0-9. A minimum of 4 digits must be present.
MM represents the month and each 'M' must be a digit from 0-9, but together "MM" must not represent a value greater than 12. "MM" must be 2 digits, use of leading zero is required for all values less than 10.
DD represents the day of the month and each 'D' must be a digit from 0-9. DD must be 2 digits (use a leading zero if necessary) and must not be greater than 31.
'T' is the date/time separator and must exist!
hh represents the hour using 0-23. mm represents the minute using 0-59. ss represents the second using 0-60. (60 for leap second) sss represents the millisecond using 0-999.
dateTime - the string to convert to a Date
ParseException - when the given string does not conform to the
above string.
protected static Date parse(String dateTime,
org.exolab.castor.xml.handlers.DateFieldHandler.ParseOptions options)
throws ParseException
CCYY represents the Year and each 'C' and 'Y' must be a digit from 0-9. A minimum of 4 digits must be present.
MM represents the month and each 'M' must be a digit from 0-9, but together "MM" must not represent a value greater than 12. "MM" must be 2 digits, use of leading zero is required for all values less than 10.
DD represents the day of the month and each 'D' must be a digit from 0-9. DD must be 2 digits (use a leading zero if necessary) and must not be greater than 31.
'T' is the date/time separator and must exist!
hh represents the hour using 0-23. mm represents the minute using 0-59. ss represents the second using 0-60. (60 for leap second) sss represents the millisecond using 0-999.
dateTime - the string to convert to a Dateoptions - the parsing options to use
ParseException - when the given string does not conform to the
above string.protected static String format(Date date)
date - the Date to format
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||