|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.finalist.tools.database.MethodInvoker
Helper class used to reflectively call setters and getters of beans and determine the return type.
Constructor Summary | |
MethodInvoker()
|
Method Summary | |
static java.lang.reflect.Method |
getBeanMethod(java.lang.Class beanClass,
java.lang.String property,
java.lang.String prefix)
Returns the method of a bean using taking the property name and a prefix. |
static java.util.ArrayList |
getGetterNames(java.lang.Object bean)
Returns the names of all the getters of the tested bean |
static java.lang.Object |
getProperty(java.lang.Object bean,
java.lang.String property)
Executes the getter method of a property of a bean. |
static java.lang.String |
getReturnType(java.lang.Object bean,
java.lang.String property)
Returns the object classname of a property of a bean. |
static boolean |
getterExists(java.lang.Object bean,
java.lang.String property)
Test a bean whether a certain getter exists for a property. |
static void |
setProperty(java.lang.Object bean,
java.lang.String property,
java.lang.Object value)
Executes the setter method of a property of a bean. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MethodInvoker()
Method Detail |
public static java.lang.reflect.Method getBeanMethod(java.lang.Class beanClass, java.lang.String property, java.lang.String prefix) throws java.lang.NoSuchMethodException
beanClass
- class of the bean object that owns the methodproperty
- that is get or set by the methodprefix
- String that is concatenated to the property
java.lang.NoSuchMethodException
- thrown when the method is not foundpublic static java.util.ArrayList getGetterNames(java.lang.Object bean)
public static java.lang.Object getProperty(java.lang.Object bean, java.lang.String property) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
bean
- the bean of which the method should be calledproperty
- the property that should be derived
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
public static void setProperty(java.lang.Object bean, java.lang.String property, java.lang.Object value) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
bean
- the bean of which the method should be calledproperty
- the property that is set
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
public static java.lang.String getReturnType(java.lang.Object bean, java.lang.String property) throws java.lang.IllegalArgumentException, java.lang.NoSuchMethodException
bean
- the bean to be examinedproperty
- the property of which the return type is returned
java.lang.IllegalArgumentException
java.lang.NoSuchMethodException
public static boolean getterExists(java.lang.Object bean, java.lang.String property)
bean
- the bean that should be testedproperty
- the property of which the return type is returned
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |