|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exolab.castor.mapping.loader.FieldHandlerFriend<T>
org.exolab.castor.mapping.ExtendedFieldHandler<T>
org.exolab.castor.mapping.AbstractFieldHandler<T>
org.exolab.castor.mapping.loader.FieldHandlerImpl<T>
public final class FieldHandlerImpl<T>
A field handler that knows how to get/set the values of a field directly or through the get/set methods. Uses reflection.
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.
| Field Summary |
|---|
| Fields inherited from class org.exolab.castor.mapping.AbstractFieldHandler |
|---|
_properties |
| Constructor Summary | |
|---|---|
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). |
|
| Method Summary | |
|---|---|
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()
|
| Methods inherited from class org.exolab.castor.mapping.AbstractFieldHandler |
|---|
getFieldDescriptor, hasValue, setConfiguration |
| Methods inherited from class org.exolab.castor.mapping.ExtendedFieldHandler |
|---|
checkValidity |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.exolab.castor.mapping.FieldHandler |
|---|
checkValidity |
| Constructor Detail |
|---|
public FieldHandlerImpl(FieldHandler<T> handler,
TypeInfo typeInfo)
handler - typeInfo - Type information
public FieldHandlerImpl(Field field,
TypeInfo typeInfo)
throws MappingException
field - The field being describedtypeInfo - Type information
MappingException - If the field is not public, is static or transient
public 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 information
MappingException - If the get or set method are not public, are static, or do not
specify the proper types| Method Detail |
|---|
public TypeConvertor getConvertFrom()
public TypeConvertor getConvertTo()
public T getValue(Object object)
object - The object
FieldHandler.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 created
IllegalStateException - This field is a simple type and cannot be instantiated
public 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 arguments
IllegalStateException - 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 setValue
public void setCreateMethod(Method method)
throws MappingException
AbstractMappingLoader and
Introspector. Please understand how this
method is used before you start playing with it! :-)
MappingException
public void setHasDeleteMethod(Method hasMethod,
Method deleteMethod)
throws MappingException
AbstractMappingLoader and
Introspector. Please understand how this
method is used before you start playing with it! :-)
MappingException
public void setReadMethod(Method method)
throws MappingException
Introspector. Please
understand how this method is used before you start playing with it! :-)
MappingException
public void setWriteMethod(Method method)
throws MappingException
Introspector. Please
understand how this method is used before you start playing with it! :-)
MappingException
public void setAddMethod(Method method)
throws MappingException
Introspector. Please
understand how this method is used before you start playing with it! :-)
MappingException
public void setEnumMethod(Method method)
throws MappingException
MappingException
public void setIterMethod(Method method)
throws MappingException
MappingExceptionpublic boolean isCollection()
public String toString()
toString in class Objectpublic void setFieldDescriptor(FieldDescriptor fieldDesc)
setFieldDescriptor in class AbstractFieldHandler<T>fieldDesc - the FieldDescriptor to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||