Package org.exolab.castor.xml.handlers
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
public class ToStringFieldHandler extends GeneralizedFieldHandler
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 org.exolab.castor.mapping.AbstractFieldHandler
_properties
-
-
Constructor Summary
Constructors Constructor Description ToStringFieldHandler(java.lang.Class type)
Creates a new ToStringFieldHandler.ToStringFieldHandler(java.lang.Class type, FieldHandler handler)
Creates a new ToStringFieldHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
convertUponGet(java.lang.Object value)
This method is used to convert the value when the getValue method is called.java.lang.Object
convertUponSet(java.lang.Object value)
This method is used to convert the value when the setValue method is called.java.lang.Class
getFieldType()
Returns the class type for the field that this GeneralizedFieldHandler converts to and from.-
Methods inherited from class org.exolab.castor.mapping.GeneralizedFieldHandler
getValue, newInstance, newInstance, resetValue, setCollectionIteration, setFieldHandler, setValue
-
Methods inherited from class org.exolab.castor.mapping.AbstractFieldHandler
getFieldDescriptor, hasValue, setConfiguration, setFieldDescriptor
-
Methods inherited from class org.exolab.castor.mapping.ExtendedFieldHandler
checkValidity
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.exolab.castor.mapping.FieldHandler
checkValidity
-
-
-
-
Constructor Detail
-
ToStringFieldHandler
public ToStringFieldHandler(java.lang.Class type)
Creates a new ToStringFieldHandler.- Parameters:
type
- the class type to create the FieldHandler for
-
ToStringFieldHandler
public ToStringFieldHandler(java.lang.Class type, FieldHandler handler)
Creates a new ToStringFieldHandler.- Parameters:
type
- the class type to create the FieldHandler forhandler
- the FieldHandler to wrap
-
-
Method Detail
-
convertUponGet
public java.lang.Object convertUponGet(java.lang.Object value)
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:
convertUponGet
in classGeneralizedFieldHandler
- Parameters:
value
- the object value to convert after performing a get operation- Returns:
- the converted value.
- See Also:
GeneralizedFieldHandler.convertUponGet(java.lang.Object)
-
convertUponSet
public java.lang.Object convertUponSet(java.lang.Object value)
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:
convertUponSet
in classGeneralizedFieldHandler
- Parameters:
value
- the object value to convert before performing a set operation- Returns:
- the converted value.
- See Also:
GeneralizedFieldHandler.convertUponSet(java.lang.Object)
-
getFieldType
public java.lang.Class 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:
getFieldType
in classGeneralizedFieldHandler
- Returns:
- the class type of of the field
- See Also:
GeneralizedFieldHandler.getFieldType()
-
-