org.exolab.castor.xml.handlers
Class DateFieldHandler

java.lang.Object
  extended byorg.exolab.castor.xml.XMLFieldHandler
      extended byorg.exolab.castor.xml.handlers.DateFieldHandler
All Implemented Interfaces:
FieldHandler

public class DateFieldHandler
extends XMLFieldHandler

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

Version:
$Revision: 1.6 $ $Date: 2001/09/07 02:03:56 $
Author:
Keith Visco

Field Summary
static java.lang.String DATE_FORMAT
           
static java.lang.String DATE_FORMAT_2
           
 
Constructor Summary
DateFieldHandler(FieldHandler fieldHandler)
          Creates a new DateFieldHandler using the given FieldHandler for delegation.
 
Method Summary
 void checkValidity(java.lang.Object object)
          Checks the field validity.
 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.
 void resetValue(java.lang.Object target)
          Sets the value of the field to a default value.
 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
setValidator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_FORMAT

public static final java.lang.String DATE_FORMAT
See Also:
Constant Field Values

DATE_FORMAT_2

public static final java.lang.String DATE_FORMAT_2
See Also:
Constant Field Values
Constructor Detail

DateFieldHandler

public DateFieldHandler(FieldHandler fieldHandler)
Creates a new DateFieldHandler using the given FieldHandler for delegation.

Parameters:
fieldHandler - the fieldHandler for delegation.
Method Detail

getValue

public java.lang.Object getValue(java.lang.Object target)
                          throws java.lang.IllegalStateException
Returns the value of the field associated with this descriptor from the given target object.

Specified by:
getValue in interface FieldHandler
Overrides:
getValue in class XMLFieldHandler
Parameters:
target - the object to get the value from
Returns:
the value of the field associated with this descriptor from the given target object.
Throws:
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 object

setValue

public void setValue(java.lang.Object target,
                     java.lang.Object value)
              throws java.lang.IllegalStateException
Sets the value of the field associated with this descriptor.

Specified by:
setValue in interface FieldHandler
Overrides:
setValue in class XMLFieldHandler
Parameters:
target - the object in which to set the value
value - the value of the field
Throws:
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 object

resetValue

public void resetValue(java.lang.Object target)
                throws java.lang.IllegalStateException
Description copied from interface: FieldHandler
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.

Specified by:
resetValue in interface FieldHandler
Overrides:
resetValue in class XMLFieldHandler
Throws:
java.lang.IllegalStateException

checkValidity

public void checkValidity(java.lang.Object object)
                   throws ValidityException,
                          java.lang.IllegalStateException
Checks the field validity. Returns successfully if the field can be stored, is valid, etc, throws an exception otherwise.

Specified by:
checkValidity in interface FieldHandler
Overrides:
checkValidity in class XMLFieldHandler
Parameters:
object - The object
Throws:
ValidityException - The field is invalid, is required and null, or any other validity violation
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 object

newInstance

public java.lang.Object newInstance(java.lang.Object parent)
                             throws java.lang.IllegalStateException
Creates a new instance of the object described by this field.

Specified by:
newInstance in interface FieldHandler
Overrides:
newInstance in class XMLFieldHandler
Parameters:
parent - The object for which the field is created
Returns:
A new instance of the field's value
Throws:
java.lang.IllegalStateException - This field is a simple type and cannot be instantiated


Intalio Inc. (C) 1999-2001. All rights reserved http://www.intalio.com