Receiver
Accessor.FieldReflection
, Accessor.GetterSetterReflection
, FieldAccessor_Boolean
, FieldAccessor_Byte
, FieldAccessor_Character
, FieldAccessor_Double
, FieldAccessor_Float
, FieldAccessor_Integer
, FieldAccessor_Long
, FieldAccessor_Ref
, FieldAccessor_Short
, MethodAccessor_Boolean
, MethodAccessor_Byte
, MethodAccessor_Character
, MethodAccessor_Double
, MethodAccessor_Float
, MethodAccessor_Integer
, MethodAccessor_Long
, MethodAccessor_Ref
, MethodAccessor_Short
, NullSafeAccessor
public abstract class Accessor<BeanT,ValueT> extends java.lang.Object implements Receiver
This interface encapsulates the access to the actual data store. The intention is to generate implementations for a particular bean and a property to improve the performance.
Accessor can be used as a receiver. Upon receiving an object it sets that to the field.
Accessor.FieldReflection
,
TransducedAccessor
Modifier and Type | Class | 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 | Description |
---|---|---|
static Accessor<javax.xml.bind.JAXBElement,java.lang.Object> |
JAXB_ELEMENT_VALUE |
Accessor for JAXBElement.getValue() . |
java.lang.Class<ValueT> |
valueType |
Modifier | Constructor | Description |
---|---|---|
protected |
Accessor(java.lang.Class<ValueT> valueType) |
Modifier and Type | Method | Description |
---|---|---|
<T> Accessor<BeanT,T> |
adapt(Adapter<java.lang.reflect.Type,java.lang.Class> adapter) |
|
<T> Accessor<BeanT,T> |
adapt(java.lang.Class<T> targetType,
java.lang.Class<? extends javax.xml.bind.annotation.adapters.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. |
java.lang.Object |
getUnadapted(BeanT bean) |
Sets the value without adapting the value.
|
java.lang.Class<ValueT> |
getValueType() |
|
boolean |
isAbstractable(java.lang.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,
java.lang.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,
java.lang.Object value) |
Sets the value without adapting the value.
|
public final java.lang.Class<ValueT> valueType
protected Accessor(java.lang.Class<ValueT> valueType)
public java.lang.Class<ValueT> getValueType()
public Accessor<BeanT,ValueT> optimize(@Nullable JAXBContextImpl context)
context
- The JAXBContextImpl
that owns the whole thing.
(See RuntimeModelBuilder.context
.)this
.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 java.lang.Object getUnadapted(BeanT bean) throws AccessorException
This ugly entry point is only used by JAX-WS.
See JAXBRIContext.getElementPropertyAccessor(java.lang.Class<B>, java.lang.String, java.lang.String)
AccessorException
public boolean isAdapted()
This method needs to be used with care, but it helps some optimization.
public void setUnadapted(BeanT bean, java.lang.Object value) throws AccessorException
This ugly entry point is only used by JAX-WS.
See JAXBRIContext.getElementPropertyAccessor(java.lang.Class<B>, java.lang.String, java.lang.String)
AccessorException
public void receive(UnmarshallingContext.State state, java.lang.Object o) throws org.xml.sax.SAXException
Receiver
public boolean isValueTypeAbstractable()
public boolean isAbstractable(java.lang.Class clazz)
clazz
- to be checkedpublic final <T> Accessor<BeanT,T> adapt(java.lang.Class<T> targetType, java.lang.Class<? extends javax.xml.bind.annotation.adapters.XmlAdapter<T,ValueT>> adapter)
public final <T> Accessor<BeanT,T> adapt(Adapter<java.lang.reflect.Type,java.lang.Class> adapter)
Copyright © 2018 Oracle Corporation. All rights reserved.