Public Member Functions | Package Functions

org.exolab.castor.mapping.loader.FieldHandlerImpl Class Reference

Inheritance diagram for org.exolab.castor.mapping.loader.FieldHandlerImpl:
org.exolab.castor.mapping.AbstractFieldHandler org.exolab.castor.mapping.ExtendedFieldHandler org.exolab.castor.mapping.loader.FieldHandlerFriend org.exolab.castor.mapping.FieldHandler

List of all members.

Public Member Functions

 FieldHandlerImpl (FieldHandler handler, TypeInfo typeInfo) throws MappingException
 FieldHandlerImpl (Field field, TypeInfo typeInfo) throws MappingException
 FieldHandlerImpl (String fieldName, Method[] getSequence, Method[] setSequence, Method getMethod, Method setMethod, TypeInfo typeInfo) throws MappingException
TypeConvertor getConvertFrom ()
TypeConvertor getConvertTo ()
String getConvertParam ()
Object getValue (Object object)
void setValue (Object object, Object value)
void resetValue (Object object)
Object newInstance (Object parent) throws IllegalStateException
Object newInstance (Object parent, Object[] args) throws IllegalStateException
void setConvertFrom (TypeConvertor convertor)
void setConvertTo (TypeConvertor convertor)
void setCreateMethod (Method method) throws MappingException
void setHasDeleteMethod (Method hasMethod, Method deleteMethod) throws MappingException
void setReadMethod (Method method) throws MappingException
void setWriteMethod (Method method) throws MappingException
void setAddMethod (Method method) throws MappingException
boolean isCollection ()
String toString ()

Package Functions

void setRequired (boolean required)

Detailed Description

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) is the former field type.

Author:
Assaf Arkin
Version:
Revision:
1.3
Date:
2004/11/05 08:55:39

Constructor & Destructor Documentation

org.exolab.castor.mapping.loader.FieldHandlerImpl.FieldHandlerImpl ( FieldHandler  handler,
TypeInfo  typeInfo 
) throws MappingException

Construct a new field handler for the specified field. The field must be public, and may not be static or transient. The field name is determined from the Java field, the type from the type information.

Parameters:
field The field being described
typeInfo Type information
Exceptions:
MappingException If the field is not public, is static or transient
org.exolab.castor.mapping.loader.FieldHandlerImpl.FieldHandlerImpl ( Field  field,
TypeInfo  typeInfo 
) throws MappingException

Construct a new field handler for the specified field. The field must be public, and may not be static or transient. The field name is determined from the Java field, the type from the type information.

Parameters:
field The field being described
typeInfo Type information
Exceptions:
MappingException If the field is not public, is static or transient
org.exolab.castor.mapping.loader.FieldHandlerImpl.FieldHandlerImpl ( String  fieldName,
Method[]  getSequence,
Method[]  setSequence,
Method  getMethod,
Method  setMethod,
TypeInfo  typeInfo 
) throws MappingException

Construct a new field handler for the specified field that is accessed through the accessor methods (get/set). The accessor methods must be public and not static. The field name is required for descriptive purposes. The field type must match the return value of the get method and the single parameter of the set method. Either get or set methods are optional.

Parameters:
fieldName The field being described
getMethod The method used to retrieve the field value, must accept no parameters and have a return type castable to the field type
setMethod The method used to set the field value, must accept a single paramater that is castable to the field type
typeInfo Type information
Exceptions:
MappingException If the get or set method are not public, are static, or do not specify the proper types

References org.exolab.castor.mapping.loader.FieldHandlerImpl.setAddMethod(), org.exolab.castor.mapping.loader.FieldHandlerImpl.setReadMethod(), and org.exolab.castor.mapping.loader.FieldHandlerImpl.setWriteMethod().


Member Function Documentation

TypeConvertor org.exolab.castor.mapping.loader.FieldHandlerImpl.getConvertFrom (  ) 
String org.exolab.castor.mapping.loader.FieldHandlerImpl.getConvertParam (  ) 
TypeConvertor org.exolab.castor.mapping.loader.FieldHandlerImpl.getConvertTo (  ) 
Object org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue ( Object  object  )  [virtual]

Returns the value of the field from the object.

Parameters:
object The object
Returns:
The value of the field
Exceptions:
IllegalStateException The Java object has changed and is no longer supported by this handler, or the handler is not compatiable with the Java object

Implements org.exolab.castor.mapping.AbstractFieldHandler.

References org.exolab.castor.mapping.TypeConvertor.convert(), org.exolab.castor.mapping.CollectionHandler.elements(), org.exolab.castor.mapping.FieldHandler.getValue(), and org.exolab.castor.mapping.loader.FieldHandlerImpl.toString().

boolean org.exolab.castor.mapping.loader.FieldHandlerImpl.isCollection (  ) 

Return true if the field is a collection.

Object org.exolab.castor.mapping.loader.FieldHandlerImpl.newInstance ( Object  parent,
Object[]  args 
) throws IllegalStateException [virtual]

Creates a new instance of the object described by this field.

Parameters:
parent The object for which the field is created
args the set of constructor arguments
Returns:
A new instance of the field's value
Exceptions:
IllegalStateException This field is a simple type and cannot be instantiated

Implements org.exolab.castor.mapping.AbstractFieldHandler.

References org.exolab.castor.mapping.FieldHandler.newInstance(), org.exolab.castor.mapping.loader.FieldHandlerImpl.newInstance(), and org.exolab.castor.mapping.loader.FieldHandlerImpl.toString().

Object org.exolab.castor.mapping.loader.FieldHandlerImpl.newInstance ( Object  parent  )  throws IllegalStateException [virtual]

Creates a new instance of the object described by this field.

Parameters:
parent The object for which the field is created
Returns:
A new instance of the field's value
Exceptions:
IllegalStateException This field is a simple type and cannot be instantiated

Implements org.exolab.castor.mapping.AbstractFieldHandler.

Referenced by org.exolab.castor.mapping.loader.FieldHandlerImpl.newInstance().

void org.exolab.castor.mapping.loader.FieldHandlerImpl.resetValue ( Object  object  )  [virtual]

Sets the value of the field to a default value.

Reference fields are set to null, primitive fields are set to their default value, collection fields are emptied of all elements.

Parameters:
object The object
Exceptions:
IllegalStateException The Java object has changed and is no longer supported by this handler, or the handler is not compatiable with the Java object

Implements org.exolab.castor.mapping.AbstractFieldHandler.

References org.exolab.castor.mapping.CollectionHandler.clear(), org.exolab.castor.mapping.FieldHandler.resetValue(), and org.exolab.castor.mapping.loader.FieldHandlerImpl.toString().

void org.exolab.castor.mapping.loader.FieldHandlerImpl.setAddMethod ( Method  method  )  throws MappingException

Mutator method used by org.exolab.castor.xml.Introspector. Please understand how this method is used before you start playing with it! :-)

Referenced by org.exolab.castor.mapping.loader.MappingLoader.createFieldHandler(), and org.exolab.castor.mapping.loader.FieldHandlerImpl.FieldHandlerImpl().

void org.exolab.castor.mapping.loader.FieldHandlerImpl.setConvertFrom ( TypeConvertor  convertor  ) 

Sets the TypeConvertor used during calls to getValue

Parameters:
convertor the TypeConvertor to use during calls to getValue

Referenced by org.exolab.castor.xml.XMLMappingLoader.createFieldDesc().

void org.exolab.castor.mapping.loader.FieldHandlerImpl.setConvertTo ( TypeConvertor  convertor  ) 

Sets the TypeConvertor used during calls to setValue

Parameters:
convertor the TypeConvertor to use during calls to setValue
void org.exolab.castor.mapping.loader.FieldHandlerImpl.setCreateMethod ( Method  method  )  throws MappingException

Mutator method used by MappingLoader and org.exolab.castor.xml.Introspector. Please understand how this method is used before you start playing with it! :-)

Referenced by org.exolab.castor.mapping.loader.MappingLoader.createFieldHandler().

void org.exolab.castor.mapping.loader.FieldHandlerImpl.setHasDeleteMethod ( Method  hasMethod,
Method  deleteMethod 
) throws MappingException

Mutator method used by MappingLoader and org.exolab.castor.xml.Introspector. Please understand how this method is used before you start playing with it! :-)

Referenced by org.exolab.castor.mapping.loader.MappingLoader.createFieldHandler().

void org.exolab.castor.mapping.loader.FieldHandlerImpl.setReadMethod ( Method  method  )  throws MappingException

Mutator method used by org.exolab.castor.xml.Introspector. Please understand how this method is used before you start playing with it! :-)

Referenced by org.exolab.castor.mapping.loader.FieldHandlerImpl.FieldHandlerImpl().

void org.exolab.castor.mapping.loader.FieldHandlerImpl.setRequired ( boolean  required  )  [package]

Mutator method used by MappingLoader.

void org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue ( Object  object,
Object  value 
) [virtual]

Sets the value of the field on the object.

Parameters:
object The object
value The new value
Exceptions:
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

Implements org.exolab.castor.mapping.AbstractFieldHandler.

References org.exolab.castor.mapping.CollectionHandler.add(), org.exolab.castor.mapping.TypeConvertor.convert(), org.exolab.castor.mapping.FieldHandler.getValue(), org.exolab.castor.mapping.FieldHandler.setValue(), and org.exolab.castor.mapping.loader.FieldHandlerImpl.toString().

void org.exolab.castor.mapping.loader.FieldHandlerImpl.setWriteMethod ( Method  method  )  throws MappingException

Mutator method used by org.exolab.castor.xml.Introspector. Please understand how this method is used before you start playing with it! :-)

Referenced by org.exolab.castor.mapping.loader.FieldHandlerImpl.FieldHandlerImpl().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties