public final class FieldHandlerImpl<T> extends AbstractFieldHandler<T>
Note: the field Java type is obtained from TypeInfo.getFieldType(), but if the field is a
collection, the actual field/accessor type is obtained from TypeInfo.getCollectionHandler()
and the object to create (with newInstance(Object)) is the former field type.
_properties| Constructor and Description |
|---|
FieldHandlerImpl(FieldHandler<T> handler,
TypeInfo typeInfo)
Construct a new field handler for the specified field.
|
FieldHandlerImpl(Field field,
TypeInfo typeInfo)
Construct a new field handler for the specified field.
|
FieldHandlerImpl(String fieldName,
Method[] getSequence,
Method[] setSequence,
Method getMethod,
Method setMethod,
TypeInfo typeInfo)
Construct a new field handler for the specified field that is accessed through the accessor
methods (get/set).
|
| Modifier and Type | Method and Description |
|---|---|
TypeConvertor |
getConvertFrom() |
TypeConvertor |
getConvertTo() |
T |
getValue(Object object)
Returns the value of the field from the object.
|
boolean |
isCollection()
Return true if the field is a collection.
|
T |
newInstance(Object parent)
Creates a new instance of the object described by this field.
|
T |
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 |
setAddMethod(Method method)
Mutator method used by
Introspector. |
void |
setConvertFrom(TypeConvertor convertor)
Sets the TypeConvertor used during calls to getValue
|
void |
setConvertTo(TypeConvertor convertor)
Sets the TypeConvertor used during calls to setValue
|
void |
setCreateMethod(Method method)
Mutator method used by
AbstractMappingLoader and
Introspector. |
void |
setEnumMethod(Method method)
Sets the enumeration method.
|
void |
setFieldDescriptor(FieldDescriptor fieldDesc)
Sets the FieldDescriptor that this FieldHander is responsibile for.
|
void |
setHasDeleteMethod(Method hasMethod,
Method deleteMethod)
Mutator method used by
AbstractMappingLoader and
Introspector. |
void |
setIterMethod(Method method)
Sets the iteration method.
|
void |
setReadMethod(Method method)
Mutator method used by
Introspector. |
void |
setValue(Object object,
T value)
Sets the value of the field on the object.
|
void |
setWriteMethod(Method method)
Mutator method used by
Introspector. |
String |
toString() |
getFieldDescriptor, hasValue, setConfigurationcheckValidityclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcheckValiditypublic FieldHandlerImpl(FieldHandler<T> handler, TypeInfo typeInfo)
handler - typeInfo - Type informationpublic FieldHandlerImpl(Field field, TypeInfo typeInfo) throws MappingException
field - The field being describedtypeInfo - Type informationMappingException - If the field is not public, is static or transientpublic FieldHandlerImpl(String fieldName, Method[] getSequence, Method[] setSequence, Method getMethod, Method setMethod, TypeInfo typeInfo) throws MappingException
fieldName - The field being describedgetMethod - The method used to retrieve the field value, must accept no parameters and
have a return type castable to the field typesetMethod - The method used to set the field value, must accept a single parameter that is
castable to the field typetypeInfo - Type informationMappingException - If the get or set method are not public, are static, or do not specify
the proper typespublic TypeConvertor getConvertFrom()
public TypeConvertor getConvertTo()
public T getValue(Object object)
object - The objectFieldHandler.getValue(java.lang.Object)public void setValue(Object object, T value)
object - The object.value - The new value.FieldHandler.setValue(java.lang.Object,
java.lang.Object)public void resetValue(Object object)
FieldHandlerReference fields are set to null, primitive fields are set to their default value, collection fields are emptied of all elements.
object - The object.public T newInstance(Object parent) throws IllegalStateException
parent - The object for which the field is createdIllegalStateException - This field is a simple type and cannot be instantiatedpublic T newInstance(Object parent, Object[] args) throws IllegalStateException
newInstance in class ExtendedFieldHandler<T>parent - The object for which the field is createdargs - the set of constructor argumentsIllegalStateException - This field is a simple type and cannot be instantiatedpublic void setConvertFrom(TypeConvertor convertor)
convertor - the TypeConvertor to use during calls to getValuepublic void setConvertTo(TypeConvertor convertor)
convertor - the TypeConvertor to use during calls to setValuepublic void setCreateMethod(Method method) throws MappingException
AbstractMappingLoader and
Introspector. Please understand how this method is used before
you start playing with it! :-)MappingExceptionpublic void setHasDeleteMethod(Method hasMethod, Method deleteMethod) throws MappingException
AbstractMappingLoader and
Introspector. Please understand how this method is used before
you start playing with it! :-)MappingExceptionpublic void setReadMethod(Method method) throws MappingException
Introspector. Please understand how this
method is used before you start playing with it! :-)MappingExceptionpublic void setWriteMethod(Method method) throws MappingException
Introspector. Please understand how this
method is used before you start playing with it! :-)MappingExceptionpublic void setAddMethod(Method method) throws MappingException
Introspector. Please understand how this
method is used before you start playing with it! :-)MappingExceptionpublic void setEnumMethod(Method method) throws MappingException
MappingExceptionpublic void setIterMethod(Method method) throws MappingException
MappingExceptionpublic boolean isCollection()
public void setFieldDescriptor(FieldDescriptor fieldDesc)
setFieldDescriptor in class AbstractFieldHandler<T>fieldDesc - the FieldDescriptor to setCopyright © 2016. All rights reserved.