BEAN - the generic type of the intercepted bean.public abstract class BeanAccessInstance<BEAN extends Bean> extends BeanAccessBase<BEAN>
BeanAccess for a regular Bean instance.| Modifier and Type | Field and Description |
|---|---|
private WritableProperty<?>[] |
properties |
private BeanAccessPrototype<BEAN> |
prototype |
LOGPROPERTY_TYPE| Constructor and Description |
|---|
BeanAccessInstance(BeanFactoryImpl beanFactory,
BeanAccessPrototype<BEAN> prototype)
The constructor.
|
fromJson, fromJsonProperty, fromJsonUndefinedProperty, get, getBean, getBeanClass, getJsonUtil, getProperties, invoke, isReadOnly, requireWritable, toJsonclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateProperty, getOrCreateProperty, getOrCreateProperty, getOrCreateProperty, getPropertyValue, getRequiredProperty, setPropertyValue, setPropertyValue, validateforEach, spliteratorprivate final BeanAccessPrototype<BEAN extends Bean> prototype
private WritableProperty<?>[] properties
public BeanAccessInstance(BeanFactoryImpl beanFactory, BeanAccessPrototype<BEAN> prototype)
beanFactory - the owning BeanFactoryImpl.prototype - the BeanAccessPrototype.public BeanAccessPrototype<BEAN> getPrototype()
getPrototype in class BeanAccessBase<BEAN extends Bean>BeanAccessPrototype.public String getSimpleName()
simple name of the Bean. The last segment of the
BeanAccess.getQualifiedName() (excluding the package name).BeanAccess.getQualifiedName()public String getQualifiedName()
qualified name of the bean interface. By default
derived from Class.getName() of the bean-interface. Will be overridden if a
Named annotation is present at the interface. If the Named.value() of the Named
annotation is unqualified (contains no dot) then the package of the
bean interface is appended. Further the name can be provided when
dynamic bean prototypes are created.
Again if an unqualified name is provided as argument, the package of the
bean interface is appended.public WritableProperty<?> getProperty(String propertyName)
propertyName - the name of the requested property or a potential
alias of the property.WritableProperty or null if no such property exists.public Iterator<WritableProperty<?>> iterator()
public String getPropertyNameForAlias(String alias)
BeanAccessproperty name. It
is defined by annotating the property method with Named and allows to support a property under a legacy
name after it has been renamed as well as to use a technical name containing special characters (e.g. "@" or ".")
for very specific cases.alias - the alias name.property name or null if no such alias is defined.public Set<String> getPropertyNames()
immutable Set with the
names of the properties.public Set<String> getDeclaredPropertyNames()
immutable Set with the
names of the properties declared by this
bean class. In other words a sub-set of BeanAccess.getPropertyNames() is returned
that excludes the names of the inherited properties.Class.getDeclaredFields()public String getPackageName()
package name of the bean class. The
qualified name excluding the simple name. Will be the
empty string for the default package (then BeanAccess.getQualifiedName() is equal to BeanAccess.getSimpleName()).BeanAccess.getQualifiedName()protected WritableProperty<?> getProperty(BeanPrototypeProperty prototypeProperty, boolean required)
BeanAccessBaseWritableProperty for the given index.getProperty in class BeanAccessBase<BEAN extends Bean>prototypeProperty - is the BeanPrototypeProperty.required - - true if the property is required and shall be created if it does not
already exist, false otherwise.WritableProperty. May be null.public <V> WritableProperty<V> createProperty(String name, GenericType<V> type)
BeanAccessWritableProperty on the fly. Creating and adding new properties is only
possible for dynamic beans.V - the generic type of the property value.name - the property name.type - the property type.public <V,PROPERTY extends WritableProperty<V>> PROPERTY createProperty(String name, GenericType<? extends V> valueType, Class<PROPERTY> propertyType)
BeanAccessWritableProperty on the fly. Creating and adding new properties is only
possible for dynamic beans.V - the generic type of the property value.PROPERTY - the generic type of the property.name - the property name.propertyType - the Class reflecting the WritableProperty to create.void createProperties()
protected abstract WritableProperty<?> createProperty(BeanPrototypeProperty prototypeProperty)
prototypeProperty - the BeanPrototypeProperty.WritableProperty instance
copied from the given
BeanPrototypeProperty.public boolean isDynamic()
true if this BeanAccess belongs to a dynamic Bean. Dynamic means that the
Bean is not strictly typed and allows to create
and add properties on the fly, false otherwise.BeanPrototypeBuilder.isDynamic(),
BeanPrototypeBuilder.getOrCreatePrototype(Class)public boolean isVirtual()
true if this BeanAccess belongs to a virtual Bean. Virtual means that the
prototype of the bean has been created via
BeanPrototypeBuilder.createPrototype(Class, String, Bean...) and represents a class (interface)
that does not exist as Java Class, false otherwise.BeanPrototypeBuilder.createPrototype(Class, String, Bean...)public boolean isPrototype()
true if this BeanAccess belongs to a prototype,
false otherwise (if it belongs to an instance).BeanFactory.createPrototype(Class),
AbstractBeanFactory.getPrototype(Bean),
BeanPrototypeBuilder.getOrCreatePrototype(Class),
BeanPrototypeBuilder.createPrototype(Class, String, Bean...)public <V,PROPERTY extends WritableProperty<V>> void addPropertyValidator(WritableProperty<?> property, AbstractValidator<? super V> validator)
BeanAccessproperty such that the provided validator is added. Therefore the Bean has to be a dynamic prototype that is not read-only.V - the generic type of the property value.PROPERTY - the generic type of the property.property - the property to update. Has to be owned by the owning Bean.validator - is the validator to add. The implementation tries its best to be
idempotent so adding the same validator again should have no effect.public <V,PROPERTY extends WritableProperty<V>> void addPropertyValidators(WritableProperty<?> property, Collection<AbstractValidator<? super V>> validators)
BeanAccessproperty such that the provided validator is added. Therefore the Bean has to be a dynamic prototype that is not read-only.V - the generic type of the property value.PROPERTY - the generic type of the property.property - the property to update. Has to be owned by the owning Bean.validators - is the Collection with the validators to add. The
implementation tries its best to be idempotent so adding the same validator again should have no effect.Copyright © 2001–2016 mmm-Team. All rights reserved.