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 () |
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.
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.
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.
value | the object value to convert after performing a get operation |
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.
value | the object value to convert before performing a set operation |
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.
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.
object | 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 |
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.
parent | The object for which the field is created | |
args | the set of constructor arguments |
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.
parent | The object for which the field is created |
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.
object | 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 |
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.
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 | ) |
Sets the FieldHandler that this FieldHander delegates to. A call to this method must be made with a non-null FieldHandler before this GeneralizedFieldHandler can be used.
handler | the FieldHandler to delegate to |
Referenced by org.exolab.castor.mapping.handlers.EnumFieldHandler.EnumFieldHandler(), org.exolab.castor.xml.Introspector.generateClassDescriptor(), org.exolab.castor.xml.descriptors.SQLTimeClassDescriptor.SQLTimeClassDescriptor(), and org.exolab.castor.xml.descriptors.SQLTimestampClassDescriptor.SQLTimestampClassDescriptor().
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.
object | The object | |
value | The new value |
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().