T - the type of the beanpublic final class ReflectiveMetaBean<T extends Bean> extends Object implements TypedMetaBean<T>
This is implementation of a meta-bean can be used directly by applications without code generation.
It requires that the bean implements Bean and has a no-arguments constructor.
Therefore, it is only suitable for mutable beans.
Typically, the meta-bean will be created as a public static final constant.
Only one method from Bean needs to be implemented, which simply returns the meta-bean.
| Modifier and Type | Method and Description |
|---|---|
Class<T> |
beanType()
Get the type of the bean, represented as a
Class. |
BeanBuilder<T> |
builder()
Creates a bean builder that can be used to create an instance of this bean.
|
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
isBuildable()
Checks whether this bean is buildable or not.
|
Map<String,MetaProperty<?>> |
metaPropertyMap()
Gets the map of meta-properties, keyed by property name.
|
static <B extends Bean> |
of(Class<B> beanClass,
String... propertyNames)
Create a meta-bean and meta properties.
|
String |
toString()
Returns a string that summarises the meta-bean.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitannotation, annotations, beanName, metaProperty, metaPropertyCount, metaPropertyExists, metaPropertyIterable, of, registerpublic static <B extends Bean> ReflectiveMetaBean<B> of(Class<B> beanClass, String... propertyNames)
The meta-properties will be created from the property names by searching for a getter and setter.
B - the type of the beanbeanClass - the bean class, not nullpropertyNames - the property names, not nullpublic boolean isBuildable()
MetaBean
A buildable bean can be constructed using MetaBean.builder().
If this method returns true then builder() must return a valid builder.
If this method returns false then builder() must throw UnsupportedOperationException.
isBuildable in interface MetaBeanpublic BeanBuilder<T> builder()
MetaBeanThe builder is used in two main ways. The first is to allow immutable beans to be constructed. The second is to enable automated tools like serialization/deserialization.
The builder can be thought of as a Map of MetaProperty to value.
Note that the implementation is not necessarily an actual map.
public Class<T> beanType()
MetaBeanClass.
A MetaBean can be thought of as the equivalent of Class but for beans.
This method allows the actual Class instance of the bean to be obtained.
public Map<String,MetaProperty<?>> metaPropertyMap()
MetaBean
Where possible, use MetaBean.metaPropertyIterable() instead as it typically has better performance.
metaPropertyMap in interface MetaBeanCopyright © 2007–2017 Joda.org. All rights reserved.