|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjlibs.core.lang.BeanUtil
public class BeanUtil
This class contains helper methods for working with java beans
| Field Summary | |
|---|---|
static String |
GET
prefix used by non-boolean getter methods |
static String |
IS
prefix used by boolean getter methods |
static String |
SET
prefix used by setter methods |
| Constructor Summary | |
|---|---|
BeanUtil()
|
|
| Method Summary | ||
|---|---|---|
static Method |
getGetterMethod(Class<?> beanClass,
String property)
Returns getter method for property in specified beanClass |
|
static Method |
getGetterMethod(Class<?> beanClass,
String property,
Class propertyType)
Returns getter method for property in specified beanClass |
|
static String |
getMethodSuffix(String property)
|
|
static
|
getProperty(Object bean,
String property)
Returns the value of the specified property in given bean |
|
static String |
getPropertyName(String methodName)
|
|
static Class |
getPropertyType(Class<?> beanClass,
String property)
Returns the type of property in given beanClass |
|
static Method |
getSetterMethod(Class<?> beanClass,
String property)
Returns setter method for property in specified beanClass |
|
static Method |
getSetterMethod(Class<?> beanClass,
String property,
Class propertyType)
Returns setter method for property in specified beanClass |
|
static void |
setProperty(Object bean,
String property,
Object value)
Sets the value of the specified property in given bean |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String GET
public static final String IS
public static final String SET
| Constructor Detail |
|---|
public BeanUtil()
| Method Detail |
|---|
public static String getMethodSuffix(String property)
public static String getPropertyName(String methodName)
public static Method getGetterMethod(Class<?> beanClass,
String property)
property in specified beanClass
beanClass - bean classproperty - name of the property
property is not foundgetGetterMethod(Class, String, Class)
public static Method getGetterMethod(Class<?> beanClass,
String property,
Class propertyType)
property in specified beanClass
beanClass - bean classproperty - name of the propertypropertyType - type of the property. This is used to compute getter method name.
property is not foundgetGetterMethod(Class, String)
public static Method getSetterMethod(Class<?> beanClass,
String property)
property in specified beanClass
beanClass - bean classproperty - name of the property
property is not found, or it is readonly propertygetSetterMethod(Class, String, Class)
public static Method getSetterMethod(Class<?> beanClass,
String property,
Class propertyType)
property in specified beanClass
beanClass - bean classproperty - name of the propertypropertyType - type of the property. This is used to compute setter method name.
property is not found, or it is readonly propertygetSetterMethod(Class, String)
public static Class getPropertyType(Class<?> beanClass,
String property)
property in given beanClass
beanClass - bean classproperty - name of the property
property
public static <T> T getProperty(Object bean,
String property)
throws InvocationTargetException
property in given bean
bean - bean objectproperty - property name whose value needs to be returned
InvocationTargetException - if method invocation fails
NullPointerException - if property is not found in bean
public static void setProperty(Object bean,
String property,
Object value)
throws InvocationTargetException
property in given bean
bean - bean objectproperty - property name whose value needs to be setvalue - value to be set
InvocationTargetException - if method invocation fails
NullPointerException - if property is not found in bean or it is readonly property
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||