public abstract class Accessor<BeanT,ValueT> extends Object implements Receiver
Accessor.FieldReflection
,
TransducedAccessor
Modifier and Type | Class and Description |
---|---|
static class |
Accessor.FieldReflection<BeanT,ValueT>
Accessor that uses Java reflection to access a field. |
static class |
Accessor.GetterOnlyReflection<BeanT,ValueT>
A version of
Accessor.GetterSetterReflection that doesn't have any setter. |
static class |
Accessor.GetterSetterReflection<BeanT,ValueT>
Accessor that uses Java reflection to access a getter and a setter. |
static class |
Accessor.ReadOnlyFieldReflection<BeanT,ValueT>
Read-only access to
Field . |
static class |
Accessor.SetterOnlyReflection<BeanT,ValueT>
A version of
Accessor.GetterSetterReflection thaat doesn't have any getter. |
Modifier and Type | Field and Description |
---|---|
static Accessor<JAXBElement,Object> |
JAXB_ELEMENT_VALUE
|
Class<ValueT> |
valueType |
Modifier | Constructor and Description |
---|---|
protected |
Accessor(Class<ValueT> valueType) |
Modifier and Type | Method and Description |
---|---|
<T> Accessor<BeanT,T> |
adapt(Adapter<Type,Class> adapter) |
<T> Accessor<BeanT,T> |
adapt(Class<T> targetType,
Class<? extends XmlAdapter<T,ValueT>> adapter)
|
abstract ValueT |
get(BeanT bean)
Gets the value of the property of the given bean object.
|
static <A,B> Accessor<A,B> |
getErrorInstance()
Gets the special
Accessor used to recover from errors. |
Object |
getUnadapted(BeanT bean)
Sets the value without adapting the value.
|
Class<ValueT> |
getValueType() |
boolean |
isAbstractable(Class clazz)
Checks if it is not builtin jaxb class
|
boolean |
isAdapted()
Returns true if this accessor wraps an adapter.
|
boolean |
isValueTypeAbstractable() |
Accessor<BeanT,ValueT> |
optimize(JAXBContextImpl context)
Returns the optimized version of the same accessor.
|
void |
receive(UnmarshallingContext.State state,
Object o)
Called when the child loader is deactivated.
|
abstract void |
set(BeanT bean,
ValueT value)
Sets the value of the property of the given bean object.
|
void |
setUnadapted(BeanT bean,
Object value)
Sets the value without adapting the value.
|
public static final Accessor<JAXBElement,Object> JAXB_ELEMENT_VALUE
public Accessor<BeanT,ValueT> optimize(@Nullable JAXBContextImpl context)
context
- The JAXBContextImpl
that owns the whole thing.
(See RuntimeModelBuilder.context
.)public abstract ValueT get(BeanT bean) throws AccessorException
bean
- must not be null.AccessorException
- if failed to set a value. For example, the getter method
may throw an exception.public abstract void set(BeanT bean, ValueT value) throws AccessorException
bean
- must not be null.value
- the value to be set. Setting value to null means resetting
to the VM default value (even for primitive properties.)AccessorException
- if failed to set a value. For example, the setter method
may throw an exception.public Object getUnadapted(BeanT bean) throws AccessorException
JAXBRIContext.getElementPropertyAccessor(java.lang.Class<B>, java.lang.String, java.lang.String)
AccessorException
public boolean isAdapted()
public void setUnadapted(BeanT bean, Object value) throws AccessorException
JAXBRIContext.getElementPropertyAccessor(java.lang.Class<B>, java.lang.String, java.lang.String)
AccessorException
public void receive(UnmarshallingContext.State state, Object o) throws SAXException
Receiver
receive
in interface Receiver
state
- points to the parent's current state.o
- object that was loaded. may be null.SAXException
public boolean isValueTypeAbstractable()
public boolean isAbstractable(Class clazz)
clazz
- to be checkedpublic final <T> Accessor<BeanT,T> adapt(Class<T> targetType, Class<? extends XmlAdapter<T,ValueT>> adapter)
Copyright © 2019 Oracle Corporation. All rights reserved.