org.joda.beans
Class MapMetaProperty<T>

java.lang.Object
  extended by org.joda.beans.MapMetaProperty<T>
All Implemented Interfaces:
MetaProperty<Map<String,T>,T>

public class MapMetaProperty<T>
extends Object
implements MetaProperty<Map<String,T>,T>

A meta-property using a Map for storage.

This meta-property uses a Map instead of a JavaBean to store the property.

Author:
Stephen Colebourne

Constructor Summary
MapMetaProperty(String propertyName)
          Constructor.
 
Method Summary
 Class<Map<String,T>> beanClass()
          Get the type of the bean represented as a Class.
 Property<Map<String,T>,T> createProperty(Map<String,T> bean)
          Creates a property that binds this meta property to a specific bean.
 T get(Map<String,T> bean)
          Gets the value of the bound property for the provided bean.
 String name()
          Gets the property name.
 Class<T> propertyClass()
          Get the type of the property represented as a Class.
 ReadWriteProperty readWrite()
          Gets whether the property is read-write, read-only or write-only.
 void set(Map<String,T> bean, T value)
          Sets the value of the bound property on the provided bean.
 String toString()
          Returns a debugging string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapMetaProperty

public MapMetaProperty(String propertyName)
Constructor.

Parameters:
propertyName - the property name
Method Detail

createProperty

public Property<Map<String,T>,T> createProperty(Map<String,T> bean)
Creates a property that binds this meta property to a specific bean.

Specified by:
createProperty in interface MetaProperty<Map<String,T>,T>
Parameters:
bean - the bean to create the bound property for
Returns:
the bound property

name

public String name()
Gets the property name.

Specified by:
name in interface MetaProperty<Map<String,T>,T>
Returns:
the name of the property

propertyClass

public Class<T> propertyClass()
Get the type of the property represented as a Class.

Specified by:
propertyClass in interface MetaProperty<Map<String,T>,T>
Returns:
the type of the property

beanClass

public Class<Map<String,T>> beanClass()
Get the type of the bean represented as a Class.

Specified by:
beanClass in interface MetaProperty<Map<String,T>,T>
Returns:
the type of the bean

readWrite

public ReadWriteProperty readWrite()
Gets whether the property is read-write, read-only or write-only.

Specified by:
readWrite in interface MetaProperty<Map<String,T>,T>
Returns:
the property read-write type

get

public T get(Map<String,T> bean)
Gets the value of the bound property for the provided bean.

This is the equivalent to calling getFoo() on the bean itself. However some implementations of this interface may not require an actual get method.

Specified by:
get in interface MetaProperty<Map<String,T>,T>
Parameters:
bean - the bean to query, not null
Returns:
the value of the property on the bound bean
Throws:
UnsupportedOperationException - if the property is write-only

set

public void set(Map<String,T> bean,
                T value)
Sets the value of the bound property on the provided bean.

This is the equivalent to calling setFoo() on the bean itself. However some implementations of this interface may not require an actual set method.

Specified by:
set in interface MetaProperty<Map<String,T>,T>
Parameters:
bean - the bean to update, not null
value - the value to set into the property on the bound bean
Throws:
UnsupportedOperationException - if the property is read-only

toString

public String toString()
Returns a debugging string.

Overrides:
toString in class Object
Returns:
a debugging string


Copyright © 2007-2010 Joda.org. All Rights Reserved.