org.joda.beans
Class SimpleProperty<B,T>

java.lang.Object
  extended by org.joda.beans.SimpleProperty<B,T>
All Implemented Interfaces:
Property<B,T>

public class SimpleProperty<B,T>
extends Object
implements Property<B,T>

Implementation of a Property that uses reflection to access get and set methods.

Author:
Stephen Colebourne

Constructor Summary
SimpleProperty(B bean, MetaProperty<B,T> metaProperty)
          Constructor.
 
Method Summary
 B bean()
          Gets the bean which owns this bound property.
 T get()
          Gets the value of the bound property.
 MetaProperty<B,T> metaProperty()
          Gets the property itself.
 void set(T value)
          Sets the value of the bound property.
 String toString()
          Returns a debugging string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleProperty

public SimpleProperty(B bean,
                      MetaProperty<B,T> metaProperty)
Constructor.

Parameters:
bean - the bean that the property is bound to, not null
metaProperty - the meta property, not null
Method Detail

bean

public B bean()
Gets the bean which owns this bound property.

Specified by:
bean in interface Property<B,T>
Returns:
the bean

metaProperty

public MetaProperty<B,T> metaProperty()
Gets the property itself.

Specified by:
metaProperty in interface Property<B,T>
Returns:
the name of the property

get

public T get()
Gets the value of the bound property.

This is the equivalent to calling getFoo() on the bean itself.

Specified by:
get in interface Property<B,T>
Returns:
the value of the property on the bound bean
Throws:
UnsupportedOperationException - if the property is write-only

set

public void set(T value)
Sets the value of the bound property.

This is the equivalent to calling setFoo() on the bean itself.

Specified by:
set in interface Property<B,T>
Parameters:
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 Joda.org. All Rights Reserved.