public final class ReflectiveMetaBean extends Object implements MetaBean
This is the standard implementation of a meta-bean.
It requires that the bean implements Bean
and has a no-arguments constructor.
Modifier and Type | Method and Description |
---|---|
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() |
<R> MetaProperty<R> |
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 <B extends Bean> |
of(Class<B> beanClass)
Factory to create a meta-bean avoiding duplicate generics.
|
String |
toString()
Returns a string that summarises the meta-bean.
|
public static <B extends Bean> ReflectiveMetaBean of(Class<B> beanClass)
B
- the type of the beanbeanClass
- the bean class, not nullpublic BeanBuilder<Bean> builder()
MetaBean
public PropertyMap createPropertyMap(Bean bean)
MetaBean
createPropertyMap
in interface MetaBean
bean
- the bean to create the map for, not nullpublic String beanName()
MetaBean
public Class<? extends Bean> beanType()
MetaBean
Class
.public int metaPropertyCount()
MetaBean
metaPropertyCount
in interface MetaBean
public boolean metaPropertyExists(String propertyName)
MetaBean
metaPropertyExists
in interface MetaBean
propertyName
- the property name to check, null returns falsepublic <R> MetaProperty<R> metaProperty(String propertyName)
MetaBean
metaProperty
in interface MetaBean
R
- the property type, optional, enabling auto-castingpropertyName
- the property name to retrieve, null throws NoSuchElementExceptionpublic 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 MetaBean
public Map<String,MetaProperty<?>> metaPropertyMap()
MetaBean
Where possible, use MetaBean.metaPropertyIterable()
instead.
metaPropertyMap
in interface MetaBean
Copyright © 2007–2013 Joda.org. All rights reserved.