T - the type of the beanMetaBean, TypedMetaBean<T>public final class ReflectiveMetaBean<T extends Bean> extends java.lang.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 | Description |
|---|---|---|
java.lang.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(java.lang.Object obj) |
|
int |
hashCode() |
|
boolean |
isBuildable() |
Checks whether this bean is buildable or not.
|
java.util.Map<java.lang.String,MetaProperty<?>> |
metaPropertyMap() |
Gets the map of meta-properties, keyed by property name.
|
static <B extends Bean> |
of(java.lang.Class<B> beanClass,
java.lang.String... propertyNames) |
Create a meta-bean and meta properties.
|
java.lang.String |
toString() |
Returns a string that summarises the meta-bean.
|
annotation, annotations, beanName, metaProperty, metaPropertyCount, metaPropertyExists, metaPropertyIterable, of, registerpublic static <B extends Bean> ReflectiveMetaBean<B> of(java.lang.Class<B> beanClass, java.lang.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 java.lang.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 java.util.Map<java.lang.String,MetaProperty<?>> metaPropertyMap()
MetaBean
Where possible, use MetaBean.metaPropertyIterable() instead as it typically has better performance.
metaPropertyMap in interface MetaBeanpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2007–2018 Joda.org. All rights reserved.