|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.exolab.castor.mapping.loader.FieldHandlerFriend org.exolab.castor.mapping.ExtendedFieldHandler org.exolab.castor.mapping.AbstractFieldHandler org.exolab.castor.mapping.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.
FieldDescriptor
,
FieldHandler
Method Summary | |
abstract java.lang.Object |
convertUponGet(java.lang.Object value)
This method is used to convert the value when the getValue method is called. |
abstract java.lang.Object |
convertUponSet(java.lang.Object value)
This method is used to convert the value when the setValue method is called. |
abstract java.lang.Class |
getFieldType()
Returns the class type for the field that this GeneralizedFieldHandler converts to and from. |
java.lang.Object |
getValue(java.lang.Object object)
Returns the value of the field from the object. |
java.lang.Object |
newInstance(java.lang.Object parent)
Creates a new instance of the object described by this field. |
java.lang.Object |
newInstance(java.lang.Object parent,
java.lang.Object[] args)
Creates a new instance of the object described by this field. |
void |
resetValue(java.lang.Object object)
Sets the value of the field to a default value. |
void |
setFieldHandler(FieldHandler handler)
Sets the FieldHandler that this FieldHander delegates to. |
void |
setValue(java.lang.Object object,
java.lang.Object value)
Sets the value of the field on the object. |
Methods inherited from class org.exolab.castor.mapping.AbstractFieldHandler |
hasValue |
Methods inherited from class org.exolab.castor.mapping.ExtendedFieldHandler |
checkValidity |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public abstract java.lang.Object convertUponGet(java.lang.Object value)
value
- the object value to convert after performing a get
operation
public abstract java.lang.Object convertUponSet(java.lang.Object value)
value
- the object value to convert before performing a set
operation
public abstract java.lang.Class getFieldType()
public final void setFieldHandler(FieldHandler handler)
handler
- the FieldHandler to delegate topublic final java.lang.Object getValue(java.lang.Object object) throws java.lang.IllegalStateException
getValue
in interface FieldHandler
getValue
in class AbstractFieldHandler
object
- The object
java.lang.IllegalStateException
- The Java object has changed and
is no longer supported by this handler, or the handler is not
compatiable with the Java objectpublic java.lang.Object newInstance(java.lang.Object parent) throws java.lang.IllegalStateException
newInstance
in interface FieldHandler
newInstance
in class AbstractFieldHandler
parent
- The object for which the field is created
java.lang.IllegalStateException
- This field is a simple type and
cannot be instantiatedpublic java.lang.Object newInstance(java.lang.Object parent, java.lang.Object[] args) throws java.lang.IllegalStateException
newInstance
in class AbstractFieldHandler
parent
- The object for which the field is createdargs
- the set of constructor arguments
java.lang.IllegalStateException
- This field is a simple type and
cannot be instantiatedpublic final void resetValue(java.lang.Object object) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
Reference fields are set to null, primitive fields are set to their default value, collection fields are emptied of all elements.
resetValue
in interface FieldHandler
resetValue
in class AbstractFieldHandler
object
- The object
java.lang.IllegalStateException
- The Java object has changed and
is no longer supported by this handler, or the handler is not
compatiable with the Java object
java.lang.IllegalArgumentException
public final void setValue(java.lang.Object object, java.lang.Object value) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
setValue
in interface FieldHandler
setValue
in class AbstractFieldHandler
object
- The objectvalue
- The new value
java.lang.IllegalStateException
- The Java object has changed and
is no longer supported by this handler, or the handler is not
compatiable with the Java object
java.lang.IllegalArgumentException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |