net.sf.japaki.beans
Interface Property<B,V>

All Known Implementing Classes:
AbstractGenericBean.GenericProperty, ArrayProperty, ConstantProperty, ReflectionProperty, SelfProperty, TransformProperty

public interface Property<B,V>

A property contains information about how to store and retrieve a data item from another object - the bean.


Method Summary
 Class<V> getType()
          Returns the type of this property, that is the return type of the getValue method.
 V getValue(B bean)
          Retrieves the value of this property from the specified bean.
 void setValue(B bean, V value)
          Stores the value in the property specified by this object in the specified bean.
 

Method Detail

getValue

V getValue(B bean)
Retrieves the value of this property from the specified bean.

Parameters:
bean - the bean from which to read the value
Returns:
the found value
Throws:
ClassCastException - if the class of the bean cannot be handled by this property (typically if generics rules are violated)
NullPointerException - if bean is null.
IllegalArgumentException - if the bean cannot be handled by this property

setValue

void setValue(B bean,
              V value)
Stores the value in the property specified by this object in the specified bean.

Parameters:
bean - the bean in which to store the value
value - the new value of the property
Throws:
UnsupportedOperationException - if the property is read-only
ClassCastException - if the class of the specified value prevents it from being stored (typically if generics rules are violated)
NullPointerException - if bean is null or if the specified value is null and the bean does not permit null values
IllegalArgumentException - if the specified value is not valid for this property.
IllegalStateException - if the value cannot be set at this time

getType

Class<V> getType()
Returns the type of this property, that is the return type of the getValue method. This method is optional.

Returns:
the type of this property or null if not specified.