net.sf.japaki.beans
Class ArrayProperty<B>

java.lang.Object
  extended by net.sf.japaki.beans.ArrayProperty<B>
All Implemented Interfaces:
Property<B,Object[]>

public class ArrayProperty<B>
extends Object
implements Property<B,Object[]>

Maps the contents of an array to a list of properties.


Method Summary
 Class<Object[]> getType()
          Returns Object[].
 Object[] getValue(B bean)
          Retrieves the value of each property in the specified bean and stores them in an array.
static
<B> Property<B,Object[]>
newInstance(List<Property<? super B,?>> properties)
          Factory method for instances of this class.
 void setValue(B bean, Object[] value)
          Stores the values of the specified array in the properties with the corresponding index in the specified bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static <B> Property<B,Object[]> newInstance(List<Property<? super B,?>> properties)
Factory method for instances of this class.

Parameters:
properties - the target properties of the getValue(B) getValue and setValue(B,Object[]) setValue methods.
Returns:
a new instances of this class
Throws:
NullPointerException - if properties is null.

getValue

public Object[] getValue(B bean)
Retrieves the value of each property in the specified bean and stores them in an array.

Specified by:
getValue in interface Property<B,Object[]>
Parameters:
bean - source of the properties' values
Returns:
an array of the values of all properties
Throws:
ClassCastException - if the class of the bean cannot be handled by this property
NullPointerException - if bean is null.
IllegalArgumentException - depending on the element properties

setValue

public void setValue(B bean,
                     Object[] value)
Stores the values of the specified array in the properties with the corresponding index in the specified bean.

Specified by:
setValue in interface Property<B,Object[]>
Parameters:
bean - target bean for the values
value - new values of the bean's properties
Throws:
UnsupportedOperationException - depending on the element properties
ClassCastException - depending on the element properties
NullPointerException - if bean is null or if the specified value is null and the bean does not permit null values
IllegalArgumentException - depending on the element properties
IllegalStateException - depending on the element properties

getType

public Class<Object[]> getType()
Returns Object[].

Specified by:
getType in interface Property<B,Object[]>
Returns:
Object[]