Class ToStringFieldHandler
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.xml.handlers.ToStringFieldHandler
- All Implemented Interfaces:
ConfigurableFieldHandler, FieldHandler
An implementation of GeneralizedFieldHandler that simply calls
Object#toString() in the conversion methods.
- Version:
- $Revision: 6671 $ $Date: 2005-02-28 17:53:23 -0700 (Mon, 28 Feb 2005) $
- Author:
- Keith Visco
-
Field Summary
Fields inherited from class AbstractFieldHandler
_propertiesModifier and TypeFieldDescriptionprotected PropertiesConfiguration that can be used by subclasses when needed. -
Constructor Summary
ConstructorsConstructorDescriptionToStringFieldHandler(Class type) Creates a new ToStringFieldHandler.ToStringFieldHandler(Class type, FieldHandler handler) Creates a new ToStringFieldHandler. -
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.Returns the class type for the field that this GeneralizedFieldHandler converts to and from.Methods inherited from class GeneralizedFieldHandler
getValue, newInstance, newInstance, resetValue, setCollectionIteration, setFieldHandler, setValueModifier and TypeMethodDescriptionfinal ObjectReturns the value of the field from the object.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.final voidresetValue(Object object) Sets the value of the field to a default value.voidsetCollectionIteration(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.final voidsetFieldHandler(FieldHandler handler) Sets the FieldHandler that this FieldHander delegates to.final voidSets the value of the field on the object.Methods inherited from class AbstractFieldHandler
getFieldDescriptor, hasValue, setConfiguration, setFieldDescriptorModifier and TypeMethodDescriptionprotected final FieldDescriptorReturns the FieldDescriptor for the field that this handler is responsible for, or null if no FieldDescriptor has been set.booleanReturns true if the "handled" field has a value within the given object.voidsetConfiguration(Properties config) Empty implementation of theConfigurableFieldHandlerinterface, for convenience purpose.voidsetFieldDescriptor(FieldDescriptor fieldDesc) Sets the FieldDescriptor that this FieldHander is responsibile for.Methods inherited from class ExtendedFieldHandler
checkValidityModifier and TypeMethodDescriptionvoidcheckValidity(Object object) Deprecated.No longer supported
-
Constructor Details
-
ToStringFieldHandler
Creates a new ToStringFieldHandler.- Parameters:
type- the class type to create the FieldHandler for
-
ToStringFieldHandler
Creates a new ToStringFieldHandler.- Parameters:
type- the class type to create the FieldHandler forhandler- the FieldHandler to wrap
-
-
Method Details
-
convertUponGet
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.- Specified by:
convertUponGetin classGeneralizedFieldHandler- Parameters:
value- the object value to convert after performing a get operation- Returns:
- the converted value.
- See Also:
-
convertUponSet
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.- Specified by:
convertUponSetin classGeneralizedFieldHandler- Parameters:
value- the object value to convert before performing a set operation- Returns:
- the converted value.
- See Also:
-
getFieldType
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.- Specified by:
getFieldTypein classGeneralizedFieldHandler- Returns:
- the class type of of the field
- See Also:
-