public abstract class GeneralizedFieldHandler extends AbstractFieldHandler
FieldDescriptor
,
FieldHandler
_properties
Modifier | Constructor and Description |
---|---|
protected |
GeneralizedFieldHandler()
Creates a new default GeneralizedFieldHandler.
|
Modifier and Type | Method and Description |
---|---|
abstract Object |
convertUponGet(Object value)
This method is used to convert the value when the getValue method
is called.
|
abstract Object |
convertUponSet(Object value)
This method is used to convert the value when the setValue method
is called.
|
abstract Class |
getFieldType()
Returns the class type for the field that this GeneralizedFieldHandler
converts to and from.
|
Object |
getValue(Object object)
Returns the value of the field from the object.
|
Object |
newInstance(Object parent)
Creates a new instance of the object described by this field.
|
Object |
newInstance(Object parent,
Object[] args)
Creates a new instance of the object described by this field.
|
void |
resetValue(Object object)
Sets the value of the field to a default value.
|
void |
setCollectionIteration(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.
|
void |
setFieldHandler(FieldHandler handler)
Sets the FieldHandler that this FieldHander delegates to.
|
void |
setValue(Object object,
Object value)
Sets the value of the field on the object.
|
getFieldDescriptor, hasValue, setConfiguration, setFieldDescriptor
checkValidity
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkValidity
protected GeneralizedFieldHandler()
public abstract Object convertUponGet(Object value)
value
- the object value to convert after performing a get
operationpublic abstract Object convertUponSet(Object value)
value
- the object value to convert before performing a set
operationpublic abstract Class getFieldType()
public final void setFieldHandler(FieldHandler handler)
handler
- the FieldHandler to delegate topublic void setCollectionIteration(boolean autoCollectionIteration)
autoCollectionIteration
- a boolean that when true indicates
that this GeneralizedFieldHandler should automatically iterate over
a collection and pass only collection items to the convertUponGet
method.public final Object getValue(Object object) throws IllegalStateException
object
- The objectIllegalStateException
- The Java object has changed and
is no longer supported by this handler, or the handler is not
compatiable with the Java objectpublic Object newInstance(Object parent) throws IllegalStateException
parent
- The object for which the field is createdIllegalStateException
- This field is a simple type and
cannot be instantiatedpublic Object newInstance(Object parent, Object[] args) throws IllegalStateException
newInstance
in class ExtendedFieldHandler
parent
- The object for which the field is createdargs
- the set of constructor argumentsIllegalStateException
- This field is a simple type and
cannot be instantiatedpublic final void resetValue(Object object) throws IllegalStateException, IllegalArgumentException
Reference fields are set to null, primitive fields are set to their default value, collection fields are emptied of all elements.
object
- The objectIllegalStateException
- The Java object has changed and
is no longer supported by this handler, or the handler is not
compatiable with the Java objectIllegalArgumentException
public final void setValue(Object object, Object value) throws IllegalStateException, IllegalArgumentException
object
- The object.value
- The new value.IllegalStateException
- The Java object has changed and is no longer
supported by this handler, or the handler is not compatiable with the
Java object.IllegalArgumentException
- The value passed is not of a supported type.Copyright © 2016. All rights reserved.