org.exolab.castor.xml.handlers
Class ValueOfFieldHandler
- ConfigurableFieldHandler, FieldHandler
public class ValueOfFieldHandler
An implementation of GeneralizedFieldHandler for classes that have a built-in
valueOf(String) factory method, such as type-safe enumeration classes,
java.sql.Timestamp, etc.
$Revision: 6671 $ $Date: 2006-04-14 04:14:43 -0600 (Fri, 14 Apr 2006) $
Object | convertUponGet(Object value) - This method is used to convert the value when the getValue method is
called.
|
Object | convertUponSet(Object value) - This method is used to convert the value when the setValue method is
called.
|
Class | getFieldType() - Returns the class type for the field that this GeneralizedFieldHandler
converts to and from.
|
Object | newInstance(Object parent) - Creates a new instance of the object described by this field.
|
ValueOfFieldHandler
public ValueOfFieldHandler(Class type)
throws MappingException
Creates a new ValueOfFieldHandler.
type
- the class type to create the FieldHandler for
convertUponGet
public Object convertUponGet(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.
- convertUponGet in interface GeneralizedFieldHandler
value
- the object value to convert after performing a get operation
convertUponSet
public Object convertUponSet(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.
- convertUponSet in interface GeneralizedFieldHandler
value
- the object value to convert before performing a set
operation
getFieldType
public 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.
- getFieldType in interface GeneralizedFieldHandler
- the class type of of the field
newInstance
public Object newInstance(Object parent)
throws IllegalStateException
Creates a new instance of the object described by this field.
- newInstance in interface FieldHandler
- newInstance in interface GeneralizedFieldHandler
parent
- The object for which the field is created
- A new instance of the field's value
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com