BEAN
- the generic type of the intercepted bean
.public abstract class BeanAccessBase<BEAN extends Bean> extends Object implements InvocationHandler, BeanAccess, Iterable<WritableProperty<?>>
BeanAccess
.Modifier and Type | Field and Description |
---|---|
private BEAN |
bean |
private Class<BEAN> |
beanClass |
private BeanFactoryImpl |
beanFactory |
(package private) static org.slf4j.Logger |
LOG |
PROPERTY_TYPE
Constructor and Description |
---|
BeanAccessBase(Class<BEAN> beanClass,
BeanFactoryImpl beanFactory)
The constructor.
|
BeanAccessBase(Class<BEAN> beanClass,
BeanFactoryImpl beanFactory,
Class<?>... interfaces)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
fromJson(javax.json.stream.JsonParser json)
Deserializes this object from JSON (JavaScript-Object-Notation).
|
protected void |
fromJsonProperty(javax.json.stream.JsonParser json)
Called from
fromJson(JsonParser) to parse a single property. |
protected void |
fromJsonUndefinedProperty(javax.json.stream.JsonParser json,
String propertyName)
Called from
fromJsonProperty(JsonParser) to parse a property that does not (yet) exist. |
(package private) static <BEAN extends Bean> |
get(BEAN bean) |
BEAN |
getBean() |
Class<BEAN> |
getBeanClass() |
protected JsonUtil |
getJsonUtil() |
Iterable<WritableProperty<?>> |
getProperties() |
protected abstract WritableProperty<?> |
getProperty(BeanPrototypeProperty prototypeProperty,
boolean create)
Gets the
WritableProperty for the given index . |
protected abstract BeanAccessPrototype<BEAN> |
getPrototype() |
Object |
invoke(Object proxy,
Method method,
Object[] args) |
boolean |
isReadOnly() |
protected void |
requireWritable(String propertyName) |
void |
toJson(javax.json.stream.JsonGenerator json)
Serializes this object as JSON (JavaScript-Object-Notation).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyValidator, addPropertyValidators, createProperty, createProperty, createProperty, getAliases, getDeclaredPropertyNames, getOrCreateProperty, getOrCreateProperty, getOrCreateProperty, getPackageName, getProperty, getPropertyNameForAlias, getPropertyNames, getPropertyValue, getQualifiedName, getRequiredProperty, getSimpleName, isDynamic, isPrototype, isVirtual, setPropertyValue, setPropertyValue, validate
forEach, iterator, spliterator
static final org.slf4j.Logger LOG
private final BeanFactoryImpl beanFactory
public BeanAccessBase(Class<BEAN> beanClass, BeanFactoryImpl beanFactory)
beanClass
- - see getBeanClass()
.beanFactory
- the owning BeanFactoryImpl
.public BeanAccessBase(Class<BEAN> beanClass, BeanFactoryImpl beanFactory, Class<?>... interfaces)
beanClass
- - see getBeanClass()
.beanFactory
- the owning BeanFactoryImpl
.interfaces
- an array with optional Bean
interfaces to be implemented by the dynamic proxy.public Class<BEAN> getBeanClass()
getBeanClass
in interface BeanAccess
Class
reflecting the owning Bean
.protected abstract BeanAccessPrototype<BEAN> getPrototype()
BeanAccessPrototype
.public Iterable<WritableProperty<?>> getProperties()
getProperties
in interface BeanAccess
Iterable
with all the properties of this Bean
.protected abstract WritableProperty<?> getProperty(BeanPrototypeProperty prototypeProperty, boolean create)
WritableProperty
for the given index
.prototypeProperty
- is the BeanPrototypeProperty
.create
- - true
if the property is required and shall be created if it does not
already exist
, false
otherwise.WritableProperty
. May be null
.public boolean isReadOnly()
isReadOnly
in interface BeanAccess
true
if this BeanAccess
belongs to a Bean
that is read-only (immutable),
false
otherwise.AbstractBeanFactory.getReadOnlyBean(Bean)
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
static <BEAN extends Bean> BeanAccessBase<BEAN> get(BEAN bean)
protected void requireWritable(String propertyName) throws ReadOnlyException
propertyName
- the optional property name or null
for write on the entire Bean
itself.ReadOnlyException
- if this Bean
is read-only
.public void toJson(javax.json.stream.JsonGenerator json)
JsonSupport
toJson
in interface JsonSupport
json
- the JsonGenerator
where to write this object to. Has to be in
JsonGenerator.writeStartObject()
state.JsonUtil.write(JsonGenerator, String, Object)
public void fromJson(javax.json.stream.JsonParser json)
JsonSupport
JsonSupport.toJson(JsonGenerator)
- e.g. JsonSupport.toJson(JsonGenerator)
might write a property with its value while
JsonSupport.fromJson(JsonParser)
may only deserialze the value as the parent object has to handle the property names
that may appear in any order.fromJson
in interface JsonSupport
json
- the JsonParser
to read from.protected void fromJsonProperty(javax.json.stream.JsonParser json)
fromJson(JsonParser)
to parse a single property.json
- the JsonParser
.protected void fromJsonUndefinedProperty(javax.json.stream.JsonParser json, String propertyName)
fromJsonProperty(JsonParser)
to parse a property that does not (yet) exist.json
- the JsonParser
.propertyName
- the name of the missing property to parse.Copyright © 2001–2016 mmm-Team. All rights reserved.