org.joda.beans
Interface MetaBean

All Known Subinterfaces:
DynamicMetaBean
All Known Implementing Classes:
BasicMetaBean, DirectMetaBean, ReflectiveMetaBean

public interface MetaBean

A meta-bean, defining those aspects of a bean which are not specific to a particular instance, such as the type and set of meta-properties.


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<? extends 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.
<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.
 

Method Detail

builder

BeanBuilder<? extends Bean> builder()
Creates a bean builder that can be used to create an instance of this bean.

Returns:
the bean builder, not null
Throws:
UnsupportedOperationException - if the bean cannot be created

createPropertyMap

PropertyMap createPropertyMap(Bean bean)
Creates a map of properties for the specified bean.

Parameters:
bean - the bean to create the map for, not null
Returns:
the created property map, not null

beanName

String beanName()
Gets the bean name, which is normally the fully qualified class name of the bean.

Returns:
the name of the bean, not empty

beanType

Class<? extends Bean> beanType()
Get the type of the bean represented as a Class.

Returns:
the type of the bean, not null

metaPropertyCount

int metaPropertyCount()
Counts the number of properties.

Returns:
the number of properties

metaPropertyExists

boolean metaPropertyExists(String propertyName)
Checks if a property exists.

Parameters:
propertyName - the property name to check, null returns false
Returns:
true if the property exists

metaProperty

<R> MetaProperty<R> metaProperty(String propertyName)
Gets a meta-property by name.

The base interface throws an exception if the name is not recognised. By contrast, the DynamicMetaBean subinterface creates the property on demand.

Type Parameters:
R - the property type, optional, enabling auto-casting
Parameters:
propertyName - the property name to retrieve, not null
Returns:
the meta property, not null
Throws:
NoSuchElementException - if the property name is invalid

metaPropertyIterable

Iterable<MetaProperty<?>> metaPropertyIterable()
Gets an iterator of meta-properties.

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 metaPropertyMap() where a choice is possible.

Returns:
the unmodifiable map of meta property objects, not null

metaPropertyMap

Map<String,MetaProperty<?>> metaPropertyMap()
Gets the map of meta-properties, keyed by property name.

Where possible, use metaPropertyIterable() instead.

Returns:
the unmodifiable map of meta property objects, not null


Copyright © 2007–2013 Joda.org. All rights reserved.