|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.japaki.beans.ReflectionProperty<B,V>
public class ReflectionProperty<B,V>
Property based on methods.
Constructor Summary | |
---|---|
ReflectionProperty(Method getter,
Method setter,
String name)
Constructs a new reflection property. |
Method Summary | ||
---|---|---|
Class<V> |
getType()
Returns the parameter type of this property. |
|
V |
getValue(B bean)
Retrieves the value of this property from the specified bean. |
|
static
|
newInstance(Class<B> beanType,
String name)
Creates a reflection property from a class and a property name. |
|
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, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ReflectionProperty(Method getter, Method setter, String name)
getter
- method that retrieves the value from the beansetter
- method that stores the value in the beanname
- name of the property. It is used for the string
representation in toString()
.Method Detail |
---|
public static <B,V> ReflectionProperty<B,V> newInstance(Class<B> beanType, String name)
beanType
- the class of the property's beanname
- property name
public V getValue(B bean)
Property
getValue
in interface Property<B,V>
bean
- the bean from which to read the value
IllegalArgumentException
- if the class of the bean does not
match with the underlying getter method.
RuntimeException
- if an IllegalAccessException
or
an InvocationTargetException
occurs.public void setValue(B bean, V value)
Property
setValue
in interface Property<B,V>
bean
- the bean in which to store the valuevalue
- the new value of the property
IllegalArgumentException
- depending on the bean
UnsupportedOperationException
- if setter is not defined.
NullPointerException
- if bean
is null
and the
setter method is an instance method.
RuntimeException
- if an IllegalAccessException
or
an InvocationTargetException
occurs.public Class<V> getType()
getType
in interface Property<B,V>
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |