public class EnumFieldHandler extends Object implements FieldHandler
Constructor and Description |
---|
EnumFieldHandler(Class enumType,
FieldHandler handler)
Creates a new EnumFieldHandler with the given type and FieldHandler.
|
Modifier and Type | Method and Description |
---|---|
void |
checkValidity(Object object)
Checks the field validity.
|
boolean |
equals(Object obj)
Returns true if the given object is an XMLFieldHandler that is equivalent
to the delegated handler.
|
Object |
getValue(Object target)
Returns the value of the field associated with this descriptor from the
given target object.
|
Object |
newInstance(Object parent)
Creates a new instance of the object described by this field.
|
void |
resetValue(Object target)
Sets the value of the field to a default value -- for enum, no action
needed.
|
void |
setValue(Object target,
Object value)
Sets the value of the field associated with this descriptor.
|
public EnumFieldHandler(Class enumType, FieldHandler handler)
enumType
- the Class type of the described fieldhandler
- the FieldHandler to delegate topublic Object getValue(Object target) throws IllegalStateException
getValue
in interface FieldHandler
target
- the object to get the value fromIllegalStateException
- The Java object has changed and is no
longer supported by this handler, or the handler is not
compatible with the Java objectpublic void setValue(Object target, Object value) throws IllegalStateException
setValue
in interface FieldHandler
target
- the object in which to set the valuevalue
- the value of the fieldIllegalStateException
- The Java object has changed and is no
longer supported by this handler, or the handler is not
compatible with the Java object.public void resetValue(Object target)
resetValue
in interface FieldHandler
target
- The object.public void checkValidity(Object object) throws ValidityException, IllegalStateException
checkValidity
in interface FieldHandler
object
- 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 objectpublic Object newInstance(Object parent) throws IllegalStateException
newInstance
in interface FieldHandler
parent
- The object for which the field is createdIllegalStateException
- This field is a simple type and cannot be
instantiatedpublic boolean equals(Object obj)
Copyright © 2016. All rights reserved.