Classes | Public Member Functions | Protected Member Functions

org.exolab.castor.mapping.GeneralizedFieldHandler Class Reference

Inheritance diagram for org.exolab.castor.mapping.GeneralizedFieldHandler:
org.exolab.castor.mapping.AbstractFieldHandler org.exolab.castor.mapping.ExtendedFieldHandler org.exolab.castor.mapping.loader.FieldHandlerFriend org.exolab.castor.mapping.FieldHandler org.exolab.castor.mapping.handlers.EnumFieldHandler org.exolab.castor.xml.handlers.SQLTimeFieldHandler org.exolab.castor.xml.handlers.SQLTimestampFieldHandler org.exolab.castor.xml.handlers.ValueOfFieldHandler

List of all members.

Classes

class  GFHConverterEnumeration

Public Member Functions

abstract Object convertUponGet (Object value)
abstract Object convertUponSet (Object value)
abstract Class getFieldType ()
final void setFieldHandler (FieldHandler handler)
void setCollectionIteration (boolean autoCollectionIteration)
final Object getValue (Object object) throws IllegalStateException
Object newInstance (Object parent) throws IllegalStateException
Object newInstance (Object parent, Object[] args) throws IllegalStateException
final void resetValue (Object object) throws IllegalStateException, IllegalArgumentException
final void setValue (Object object, Object value) throws IllegalStateException, IllegalArgumentException

Protected Member Functions

 GeneralizedFieldHandler ()

Detailed Description

An extended version of the FieldHandler interface which is used for making generic libraries of FieldHandlers which can be used for more than one field or class, but have similar conversion algorithms.

Author:
Keith Visco
Version:
Revision:
1.3
Date:
2005/01/19 00:29:45
See also:
FieldDescriptor
FieldHandler

Constructor & Destructor Documentation

org.exolab.castor.mapping.GeneralizedFieldHandler.GeneralizedFieldHandler (  )  [protected]

Creates a new default GeneralizedFieldHandler. This method should be called by all extending classes so that any important initialization code will be executed.


Member Function Documentation

abstract Object org.exolab.castor.mapping.GeneralizedFieldHandler.convertUponGet ( Object  value  )  [pure virtual]

This method is used to convert the value when the getValue method is called. The getValue method will obtain the actual field value from given 'parent' object. This convert method is then invoked with the field's value. The value returned from this method will be the actual value returned by getValue method.

Parameters:
value the object value to convert after performing a get operation
Returns:
the converted value.

Implemented in org.exolab.castor.mapping.handlers.EnumFieldHandler, org.exolab.castor.xml.handlers.SQLTimeFieldHandler, org.exolab.castor.xml.handlers.SQLTimestampFieldHandler, and org.exolab.castor.xml.handlers.ValueOfFieldHandler.

Referenced by org.exolab.castor.mapping.GeneralizedFieldHandler.getValue().

abstract Object org.exolab.castor.mapping.GeneralizedFieldHandler.convertUponSet ( Object  value  )  [pure virtual]

This method is used to convert the value when the setValue method is called. The setValue method will call this method to obtain the converted value. The converted value will then be used as the value to set for the field.

Parameters:
value the object value to convert before performing a set operation
Returns:
the converted value.

Implemented in org.exolab.castor.mapping.handlers.EnumFieldHandler, org.exolab.castor.xml.handlers.SQLTimeFieldHandler, org.exolab.castor.xml.handlers.SQLTimestampFieldHandler, and org.exolab.castor.xml.handlers.ValueOfFieldHandler.

Referenced by org.exolab.castor.mapping.GeneralizedFieldHandler.setValue().

abstract Class org.exolab.castor.mapping.GeneralizedFieldHandler.getFieldType (  )  [pure virtual]

Returns the class type for the field that this GeneralizedFieldHandler converts to and from. This should be the type that is used in the object model.

Returns:
the class type of of the field

Implemented in org.exolab.castor.mapping.handlers.EnumFieldHandler, org.exolab.castor.xml.handlers.SQLTimeFieldHandler, org.exolab.castor.xml.handlers.SQLTimestampFieldHandler, and org.exolab.castor.xml.handlers.ValueOfFieldHandler.

Referenced by org.exolab.castor.xml.Introspector.generateClassDescriptor().

final Object org.exolab.castor.mapping.GeneralizedFieldHandler.getValue ( Object  object  )  throws IllegalStateException [virtual]

Returns the value of the field from the object.

Parameters:
object The object
Returns:
The value of the field
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

Implements org.exolab.castor.mapping.AbstractFieldHandler.

References org.exolab.castor.mapping.GeneralizedFieldHandler.convertUponGet(), org.exolab.castor.mapping.CollectionHandler.elements(), and org.exolab.castor.mapping.FieldHandler.getValue().

Object org.exolab.castor.mapping.GeneralizedFieldHandler.newInstance ( Object  parent,
Object[]  args 
) throws IllegalStateException [virtual]

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

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

Implements org.exolab.castor.mapping.AbstractFieldHandler.

Reimplemented in org.exolab.castor.mapping.handlers.EnumFieldHandler.

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

Object org.exolab.castor.mapping.GeneralizedFieldHandler.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

Implements org.exolab.castor.mapping.AbstractFieldHandler.

Reimplemented in org.exolab.castor.mapping.handlers.EnumFieldHandler, org.exolab.castor.xml.handlers.SQLTimeFieldHandler, org.exolab.castor.xml.handlers.SQLTimestampFieldHandler, and org.exolab.castor.xml.handlers.ValueOfFieldHandler.

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

Referenced by org.exolab.castor.mapping.GeneralizedFieldHandler.newInstance().

final void org.exolab.castor.mapping.GeneralizedFieldHandler.resetValue ( Object  object  )  throws IllegalStateException, IllegalArgumentException [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

Implements org.exolab.castor.mapping.AbstractFieldHandler.

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

void org.exolab.castor.mapping.GeneralizedFieldHandler.setCollectionIteration ( boolean  autoCollectionIteration  ) 

Sets whether or not this GeneralizedFieldHandler should automatically iterate over the collection returned by the target object and pass only the items (one by one) to the convertUponGet method.

As of Castor 0.9.6 this is true by default.

Parameters:
autoCollectionIteration a boolean that when true indicates that this GeneralizedFieldHandler should automatically iterate over a collection and pass only collection items to the convertUponGet method.
final void org.exolab.castor.mapping.GeneralizedFieldHandler.setFieldHandler ( FieldHandler  handler  ) 
final void org.exolab.castor.mapping.GeneralizedFieldHandler.setValue ( Object  object,
Object  value 
) throws IllegalStateException, IllegalArgumentException [virtual]

Sets the value of the field on the object.

Parameters:
object The object
value The new value
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 IllegalArgumentException The value passed is not of a supported type

Implements org.exolab.castor.mapping.AbstractFieldHandler.

References org.exolab.castor.mapping.GeneralizedFieldHandler.convertUponSet(), 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