|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.joda.beans.impl.reflection.ReflectiveMetaBean
public final class ReflectiveMetaBean
A standard meta-bean implementation.
This is the standard implementation of a meta-bean.
It requires that the bean implements Bean and has a no-arguments constructor.
| Method Summary | ||
|---|---|---|
String |
beanName()
Gets the bean name, which is normally the fully qualified class name of the bean. |
|
Class<? extends Bean> |
beanType()
Get the type of the bean, represented as a Class. |
|
BeanBuilder<Bean> |
builder()
Creates a bean builder that can be used to create an instance of this bean. |
|
PropertyMap |
createPropertyMap(Bean bean)
Creates a map of properties for the specified bean. |
|
boolean |
equals(Object obj)
|
|
int |
hashCode()
|
|
|
metaProperty(String propertyName)
Gets a meta-property by name. |
|
int |
metaPropertyCount()
Counts the number of properties. |
|
boolean |
metaPropertyExists(String propertyName)
Checks if a property exists. |
|
Iterable<MetaProperty<?>> |
metaPropertyIterable()
Gets an iterator of meta-properties. |
|
Map<String,MetaProperty<?>> |
metaPropertyMap()
Gets the map of meta-properties, keyed by property name. |
|
static
|
of(Class<B> beanClass)
Factory to create a meta-bean avoiding duplicate generics. |
|
String |
toString()
Returns a string that summarises the meta-bean. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <B extends Bean> ReflectiveMetaBean of(Class<B> beanClass)
B - the type of the beanbeanClass - the bean class, not null
public BeanBuilder<Bean> 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.
builder in interface MetaBeanpublic PropertyMap createPropertyMap(Bean bean)
MetaBean
This allows the entire set of properties of the bean to be exposed as a Map.
The map is keyed by the property name and has Property instances as values.
Call PropertyMap.flatten() to convert the map to hold the actual values from the bean.
createPropertyMap in interface MetaBeanbean - the bean to create the map for, not null
public String beanName()
MetaBeanThis is primarily used for human-readable output.
beanName in interface MetaBeanpublic Class<? extends Bean> 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.
beanType in interface MetaBeanpublic int metaPropertyCount()
MetaBeanEach meta-bean manages a single bean with a known set of properties. This method returns the count of properties.
metaPropertyCount in interface MetaBeanpublic boolean metaPropertyExists(String propertyName)
MetaBeanEach meta-bean manages a single bean with a known set of properties. This method checks whether there is a property with the specified name.
metaPropertyExists in interface MetaBeanpropertyName - the property name to check, null returns false
public <R> MetaProperty<R> metaProperty(String propertyName)
MetaBeanEach meta-bean manages a single bean with a known set of properties. This method returns the property with the specified name.
The base interface throws an exception if the name is not recognised.
By contrast, the DynamicMetaBean subinterface creates the property on demand.
metaProperty in interface MetaBeanR - the property type, optional, enabling auto-castingpropertyName - the property name to retrieve, not null
public Iterable<MetaProperty<?>> metaPropertyIterable()
MetaBean
This method returns an Iterable, which is simpler than a Map.
As a result, implementations may be able to optimise, and so this method should be
preferred to MetaBean.metaPropertyMap() where a choice is possible.
metaPropertyIterable in interface MetaBeanpublic Map<String,MetaProperty<?>> metaPropertyMap()
MetaBean
Where possible, use MetaBean.metaPropertyIterable() instead as it typically has better performance.
metaPropertyMap in interface MetaBeanpublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||