Classes | Public Member Functions | Static Public Member Functions | Static Protected Member Functions

org.exolab.castor.xml.handlers.DateFieldHandler Class Reference

Inheritance diagram for org.exolab.castor.xml.handlers.DateFieldHandler:
org.exolab.castor.xml.XMLFieldHandler org.exolab.castor.mapping.AbstractFieldHandler org.exolab.castor.mapping.ExtendedFieldHandler org.exolab.castor.mapping.loader.FieldHandlerFriend org.exolab.castor.mapping.FieldHandler

List of all members.

Classes

class  ParseOptions

Public Member Functions

 DateFieldHandler (FieldHandler fieldHandler)
Object getValue (Object target) throws java.lang.IllegalStateException
void setValue (Object target, Object value) throws java.lang.IllegalStateException
void resetValue (Object target) throws java.lang.IllegalStateException
Object newInstance (Object parent) throws IllegalStateException
boolean equals (Object obj)
void setUseSQLDate (boolean useSQLDate)

Static Public Member Functions

static void setAllowTimeZoneSuppression (boolean allowTimeZoneSuppression)
static void setDefaultTimeZone (TimeZone timeZone)
static void setSuppressMillis (boolean suppressMillis)

Static Protected Member Functions

static Date parse (String dateTime) throws ParseException
static Date parse (String dateTime, ParseOptions options) throws ParseException
static String format (Date date)

Detailed Description

A specialized FieldHandler for the XML Schema Date/Time related types

Author:
Keith Visco
Version:
Revision:
1.14
Date:
2005/02/09 20:04:19

Constructor & Destructor Documentation

org.exolab.castor.xml.handlers.DateFieldHandler.DateFieldHandler ( FieldHandler  fieldHandler  ) 

Creates a new DateFieldHandler using the given FieldHandler for delegation.

Parameters:
fieldHandler the fieldHandler for delegation.

Member Function Documentation

boolean org.exolab.castor.xml.handlers.DateFieldHandler.equals ( Object  obj  ) 

Returns true if the given object is an XMLFieldHandler that is equivalent to the delegated handler. An equivalent XMLFieldHandler is an XMLFieldHandler that is an instances of the same class.

Returns:
true if the given object is an XMLFieldHandler that is equivalent to this one.

Reimplemented from org.exolab.castor.xml.XMLFieldHandler.

static String org.exolab.castor.xml.handlers.DateFieldHandler.format ( Date  date  )  [static, protected]

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.

Parameters:
date the Date to format
Returns:
the formatted string

Referenced by org.exolab.castor.xml.handlers.DateFieldHandler.getValue().

Object org.exolab.castor.xml.handlers.DateFieldHandler.getValue ( Object  target  )  throws java.lang.IllegalStateException [virtual]

Returns the value of the field associated with this descriptor from the given target object.

Parameters:
target the object to get the value from
Returns:
the value of the field associated with this descriptor from the given target object.

Reimplemented from org.exolab.castor.xml.XMLFieldHandler.

References org.exolab.castor.xml.handlers.DateFieldHandler.format(), and org.exolab.castor.mapping.FieldHandler.getValue().

Object org.exolab.castor.xml.handlers.DateFieldHandler.newInstance ( Object  parent  )  throws IllegalStateException [virtual]

Creates a new instance of the object described by this field.

Parameters:
parent The object for which the field is created
Returns:
A new instance of the field's value
Exceptions:
IllegalStateException This field is a simple type and cannot be instantiated

Reimplemented from org.exolab.castor.xml.XMLFieldHandler.

References org.exolab.castor.mapping.FieldHandler.newInstance().

static Date org.exolab.castor.xml.handlers.DateFieldHandler.parse ( String  dateTime  )  throws ParseException [static, protected]

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. The letter "T" is the date/time separator and "hh", "mm", "ss" represent hour, minute and second respectively.

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.

Parameters:
dateTime the string to convert to a Date
Returns:
a new Date that represents the given string.
Exceptions:
ParseException when the given string does not conform to the above string.

Referenced by org.exolab.castor.xml.handlers.DateFieldHandler.setValue().

static Date org.exolab.castor.xml.handlers.DateFieldHandler.parse ( String  dateTime,
ParseOptions  options 
) throws ParseException [static, protected]

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. The letter "T" is the date/time separator and "hh", "mm", "ss" represent hour, minute and second respectively.

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.

Parameters:
dateTime the string to convert to a Date
Returns:
a new Date that represents the given string.
Exceptions:
ParseException when the given string does not conform to the above string.
void org.exolab.castor.xml.handlers.DateFieldHandler.resetValue ( Object  object  )  throws java.lang.IllegalStateException [virtual]

Sets the value of the field to a default value.

Reference fields are set to null, primitive fields are set to their default value, collection fields are emptied of all elements.

Parameters:
object The object
Exceptions:
IllegalStateException The Java object has changed and is no longer supported by this handler, or the handler is not compatiable with the Java object

Reimplemented from org.exolab.castor.xml.XMLFieldHandler.

References org.exolab.castor.mapping.FieldHandler.resetValue().

static void org.exolab.castor.xml.handlers.DateFieldHandler.setAllowTimeZoneSuppression ( boolean  allowTimeZoneSuppression  )  [static]

Sets whether or not UTC time should always be used when marshalling out xsd:dateTime values.

static void org.exolab.castor.xml.handlers.DateFieldHandler.setDefaultTimeZone ( TimeZone  timeZone  )  [static]

Sets the default TimeZone used for comparing dates when marshalling out xsd:dateTime values using this handler. This is used when determining if the timezone can be omitted when marshalling.

Default is JVM default returned by TimeZone.getDefault()

Parameters:
timeZone TimeZone to use instead of JVM default
See also:
setAllowTimeZoneSuppression
static void org.exolab.castor.xml.handlers.DateFieldHandler.setSuppressMillis ( boolean  suppressMillis  )  [static]

Sets a flag indicating whether or not Milliseconds should be suppressed upon formatting a dateTime as a String

Parameters:
suppressMills a boolean when true indicates that millis should be suppressed during conversion of a dateTime to a String
void org.exolab.castor.xml.handlers.DateFieldHandler.setUseSQLDate ( boolean  useSQLDate  ) 

Specifies that this DateFieldHandler should use java.sql.Date when creating new Date instances.

Parameters:
useSQLDate a boolean that when true indicates that java.sql.Date should be used instead of java.util.Date.

Referenced by org.exolab.castor.xml.Introspector.generateClassDescriptor(), and org.exolab.castor.xml.descriptors.SQLDateClassDescriptor.SQLDateClassDescriptor().

void org.exolab.castor.xml.handlers.DateFieldHandler.setValue ( Object  target,
Object  value 
) throws java.lang.IllegalStateException [virtual]

Sets the value of the field associated with this descriptor.

Parameters:
target the object in which to set the value
value the value of the field

Reimplemented from org.exolab.castor.xml.XMLFieldHandler.

References org.exolab.castor.xml.handlers.DateFieldHandler.parse(), and org.exolab.castor.mapping.FieldHandler.setValue().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties