Class EnumFieldHandler
java.lang.Object
org.exolab.castor.mapping.loader.FieldHandlerFriend
org.exolab.castor.mapping.ExtendedFieldHandler
org.exolab.castor.mapping.AbstractFieldHandler
org.exolab.castor.mapping.GeneralizedFieldHandler
org.exolab.castor.mapping.handlers.EnumFieldHandler
- All Implemented Interfaces:
ConfigurableFieldHandler,FieldHandler
A specialized FieldHandler for the type-safe enum
style classes.
Adapted from org.exolab.castor.xml.handlers.EnumFieldHandler
which is used for the generated source code.
- Version:
- $Revision: 6238 $ $Date: 2006-04-13 06:47:36 -0600 (Thu, 13 Apr 2006) $
- Author:
- Keith Visco
-
Field Summary
Fields inherited from class org.exolab.castor.mapping.AbstractFieldHandler
_properties -
Constructor Summary
ConstructorsConstructorDescriptionEnumFieldHandler(Class enumType, FieldHandler handler, Method createMethod) Creates a new EnumFieldHandler with the given type and FieldHandler -
Method Summary
Modifier and TypeMethodDescriptionconvertUponGet(Object value) This method is used to convert the value when the getValue method is called.convertUponSet(Object value) This method is used to convert the value when the setValue method is called.booleanReturns true if the given object is an XMLFieldHandler that is equivalent to the delegated handler.Returns the class type for the field that this GeneralizedFieldHandler converts to and from.newInstance(Object parent) Creates a new instance of the object described by this field.newInstance(Object parent, Object[] args) Creates a new instance of the object described by this field.Methods inherited from class org.exolab.castor.mapping.GeneralizedFieldHandler
getValue, resetValue, setCollectionIteration, setFieldHandler, setValueMethods inherited from class org.exolab.castor.mapping.AbstractFieldHandler
getFieldDescriptor, hasValue, setConfiguration, setFieldDescriptorMethods inherited from class org.exolab.castor.mapping.ExtendedFieldHandler
checkValidityMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.exolab.castor.mapping.FieldHandler
checkValidity
-
Constructor Details
-
EnumFieldHandler
Creates a new EnumFieldHandler with the given type and FieldHandler- Parameters:
enumType- the Class type of the described fieldhandler- the FieldHandler to delegate to
-
-
Method Details
-
convertUponGet
Description copied from class:GeneralizedFieldHandlerThis 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.- Specified by:
convertUponGetin classGeneralizedFieldHandler- Parameters:
value- the object value to convert after performing a get operation- Returns:
- the converted value.
- See Also:
-
convertUponSet
Description copied from class:GeneralizedFieldHandlerThis 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.- Specified by:
convertUponSetin classGeneralizedFieldHandler- Parameters:
value- the object value to convert before performing a set operation- Returns:
- the converted value.
- Throws:
IllegalStateException- See Also:
-
getFieldType
Description copied from class:GeneralizedFieldHandlerReturns 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.- Specified by:
getFieldTypein classGeneralizedFieldHandler- Returns:
- the class type of of the field
- See Also:
-
newInstance
Description copied from class:GeneralizedFieldHandlerCreates a new instance of the object described by this field.- Specified by:
newInstancein interfaceFieldHandler- Overrides:
newInstancein classGeneralizedFieldHandler- Parameters:
parent- The object for which the field is created- Returns:
- A new instance of the field's value
- Throws:
IllegalStateException- This field is a simple type and cannot be instantiated- See Also:
-
newInstance
Description copied from class:GeneralizedFieldHandlerCreates a new instance of the object described by this field.- Overrides:
newInstancein classGeneralizedFieldHandler- Parameters:
parent- The object for which the field is createdargs- the set of constructor arguments- Returns:
- A new instance of the field's value
- Throws:
IllegalStateException- This field is a simple type and cannot be instantiated- See Also:
-
equals
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.
-