public final class ContainerFieldHandler extends Object implements FieldHandler
org.exolab.castor.mapping.FieldDescriptor,
org.exolab.castor.mapping.FieldHandler| Modifier and Type | Field and Description |
|---|---|
static int |
MODE_AUTO
Automatically choose the mode to use.
|
static int |
MODE_CHILD_LINK
The mode for a ContainerElement.
|
static int |
MODE_PARENT_LINK
When the field is not a ContainerElement, this mode is used.
|
| Constructor and Description |
|---|
ContainerFieldHandler(FieldHandler handler)
Creates a new ContainerFieldHandler with the given FieldHandler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkValidity(Object object)
Checks the field validity.
|
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.
|
void |
resetValue(Object object)
Sets the value of the field to a default value.
|
void |
setValue(Object object,
Object value)
Sets the value of the field on the object.
|
public static final int MODE_AUTO
public static final int MODE_PARENT_LINK
public static final int MODE_CHILD_LINK
public ContainerFieldHandler(FieldHandler handler)
handler - The field handler to delegate to.public Object getValue(Object object) throws IllegalStateException
getValue in interface FieldHandlerobject - The object to get the value ofIllegalStateException - The Java object has changed and is no longer supported by this
handler, or the handler is not compatible with the Java objectpublic Object newInstance(Object parent) throws IllegalStateException
newInstance in interface FieldHandlerparent - The object for which the field is createdIllegalStateException - This field is a simple type and cannot be instantiatedpublic void resetValue(Object object) throws IllegalStateException
Reference fields are set to null, primitive fields are set to their default value, collection fields are emptied of all elements.
resetValue in interface FieldHandlerobject - 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 void setValue(Object object, Object value) throws IllegalStateException, IllegalArgumentException
setValue in interface FieldHandlerobject - The object whose value to set.value - The new valueIllegalStateException - The Java object has changed and is no longer supported by this
handler, or the handler is not compatiable with the Java objectIllegalArgumentException - The value passed is not of a supported typepublic void checkValidity(Object object) throws ValidityException, IllegalStateException
checkValidity in interface FieldHandlerobject - The objectValidityException - The field is invalid, is required and null, or any other validity
violationIllegalStateException - The Java object has changed and is no longer supported by this
handler, or the handler is not compatiable with the Java objectCopyright © 2016. All rights reserved.