Package org.exolab.castor.mapping
Class AbstractFieldHandler
- java.lang.Object
-
- org.exolab.castor.mapping.loader.FieldHandlerFriend
-
- org.exolab.castor.mapping.ExtendedFieldHandler
-
- org.exolab.castor.mapping.AbstractFieldHandler
-
- All Implemented Interfaces:
ConfigurableFieldHandler
,FieldHandler
- Direct Known Subclasses:
FieldHandlerImpl
,GeneralizedFieldHandler
,TransientFieldHandler
,XMLFieldHandler
public abstract class AbstractFieldHandler extends ExtendedFieldHandler implements ConfigurableFieldHandler
An extended version of the FieldHandler interface which is used for adding additional functionality while preserving backward compatability.- Version:
- $Revision: 8776 $ $Date: 2005-08-03 15:11:51 -0600 (Wed, 03 Aug 2005) $
- Author:
- Keith Visco
- See Also:
FieldDescriptor
,FieldHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Properties
_properties
Configuration that can be used by subclasses when needed.
-
Constructor Summary
Constructors Constructor Description AbstractFieldHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FieldDescriptor
getFieldDescriptor()
Returns the FieldDescriptor for the field that this handler is responsible for, or null if no FieldDescriptor has been set.boolean
hasValue(java.lang.Object object)
Returns true if the "handled" field has a value within the given object.void
setConfiguration(java.util.Properties config)
Empty implementation of theConfigurableFieldHandler
interface, for convenience purpose.void
setFieldDescriptor(FieldDescriptor fieldDesc)
Sets the FieldDescriptor that this FieldHander is responsibile for.-
Methods inherited from class org.exolab.castor.mapping.ExtendedFieldHandler
checkValidity, newInstance
-
Methods inherited from class org.exolab.castor.mapping.loader.FieldHandlerFriend
getValue, newInstance, resetValue, setValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.exolab.castor.mapping.FieldHandler
checkValidity, getValue, newInstance, resetValue, setValue
-
-
-
-
Method Detail
-
getFieldDescriptor
protected final FieldDescriptor getFieldDescriptor()
Returns the FieldDescriptor for the field that this handler is responsible for, or null if no FieldDescriptor has been set. This method is useful for implementations of theFieldHandler
interface that wish to obtain information about the field in order to make the FieldHandler more generic and reusable, or simply for validation purposes.- Specified by:
getFieldDescriptor
in classFieldHandlerFriend
- Returns:
- the
FieldDescriptor
, or null if none exists.
-
setFieldDescriptor
public void setFieldDescriptor(FieldDescriptor fieldDesc)
Sets the FieldDescriptor that this FieldHander is responsibile for. By setting the FieldDescriptor, it allows the implementation of the FieldHandler methods to obtain information about the field itself. This allows a particular implementation to become more generic and reusable.- Specified by:
setFieldDescriptor
in classFieldHandlerFriend
- Parameters:
fieldDesc
- the FieldDescriptor to set
-
hasValue
public boolean hasValue(java.lang.Object object)
Returns true if the "handled" field has a value within the given object.By default this just checks for null. Normally this method is needed for checking if a value has been set via a call to the setValue method, or if the primitive value has been initialised by the JVM.
This method should be overloaded for improved value checking.
- Returns:
- true if the given object has a value for the handled field
-
setConfiguration
public void setConfiguration(java.util.Properties config) throws ValidityException
Empty implementation of theConfigurableFieldHandler
interface, for convenience purpose. Subclasses that want to use any configuration should override this method.- Specified by:
setConfiguration
in interfaceConfigurableFieldHandler
- Parameters:
config
- The configuration as specified in the mapping file.- Throws:
ValidityException
- if config is invalid for this FieldHandler.
-
-