net.sf.japaki.beans
Class AbstractGenericBean.GenericProperty<B extends AbstractGenericBean,V>

java.lang.Object
  extended by net.sf.japaki.beans.AbstractGenericBean.GenericProperty<B,V>
All Implemented Interfaces:
Property<B,V>
Enclosing class:
AbstractGenericBean<B extends GenericBean<B>>

protected static class AbstractGenericBean.GenericProperty<B extends AbstractGenericBean,V>
extends Object
implements Property<B,V>

Property implementation for AbstractGenericBean based on getValue and setValue.


Constructor Summary
AbstractGenericBean.GenericProperty(String name, int hashCode, Class<V> type)
          Constructs a new generic property.
 
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.
 int hashCode()
           
static
<B extends AbstractGenericBean,V>
AbstractGenericBean.GenericProperty<B,V>
newInstance(String name, int hashCode, Class<? super V> type)
          Constructs a new generic property.
 void setValue(B bean, V value)
          Stores the value in the property specified by this object in the specified bean.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractGenericBean.GenericProperty

public AbstractGenericBean.GenericProperty(String name,
                                           int hashCode,
                                           Class<V> type)
Constructs a new generic property.

Parameters:
name - name of the property.
hashCode - hashCode of the new property. It can be used to store properties or the values in a list.
type - the class of the property's values.
Method Detail

newInstance

public static <B extends AbstractGenericBean,V> AbstractGenericBean.GenericProperty<B,V> newInstance(String name,
                                                                                                     int hashCode,
                                                                                                     Class<? super V> type)
Constructs a new generic property. The type variable of the type is not checked exactly. This is necessary in cases where the value type of the property is generic itself.

Parameters:
name - name of the property.
hashCode - hashCode of the new property. It can be used to store properties or the values in a list.
type - the class of the property's values.

getValue

public V getValue(B bean)
Description copied from interface: Property
Retrieves the value of this property from the specified bean.

Specified by:
getValue in interface Property<B extends AbstractGenericBean,V>
Parameters:
bean - the bean from which to read the value
Returns:
the found value
Throws:
NullPointerException - if bean is null.
IllegalArgumentException - if the property is unknown to the bean

setValue

public void setValue(B bean,
                     V value)
Description copied from interface: Property
Stores the value in the property specified by this object in the specified bean.

Specified by:
setValue in interface Property<B extends AbstractGenericBean,V>
Parameters:
bean - the bean in which to store the value
value - the new value of the property
Throws:
NullPointerException - if bean is null.
IllegalArgumentException - if the property is unknown to the bean

getType

public Class<V> getType()
Description copied from interface: Property
Returns the type of this property, that is the return type of the getValue method. This method is optional.

Specified by:
getType in interface Property<B extends AbstractGenericBean,V>
Returns:
the type of this property or null if not specified.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object