|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ujac.util.BeanUtils
public class BeanUtils
Name: BeanUtils
Description: Class providing common utility methods for java bean access.
| Field Summary | |
|---|---|
static Class[] |
GETTER_ARG_TYPES
The argument type list for a getter method. |
static Object[] |
GETTER_ARGS
The argument list for a getter method. |
| Constructor Summary | |
|---|---|
BeanUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
between(Comparable obj,
Comparable from,
Comparable to)
Checks if the given object is between the last two parameter values. |
static int |
compare(Comparable a,
Comparable b)
Compares the given values. |
static boolean |
equals(Object a,
Object b)
Checks if the given objects are equal. |
static boolean |
equals(Object a,
Object b,
boolean caseSensitive)
Checks if the given objects are equal. |
static Object |
getProperty(Object bean,
String propertyName)
Gets a property from the given bean. |
static Object |
getProperty(Object bean,
String propertyName,
boolean lenient)
Gets a property from the given bean. |
static Class |
getPropertyType(Class clazz,
String propertyName,
boolean lenient)
Gets a property from the given bean. |
static Object |
invokeGetter(Object bean,
Method getterMethod)
Invokes a getter method with the given value. |
static void |
invokeSetter(Object bean,
Method setterMethod,
Object value)
Invokes a setter method with the given value. |
static void |
invokeSetter(Object bean,
Method setterMethod,
Object value,
TypeConverter typeConverter)
Invokes a setter method with the given value. |
static boolean |
isEmpty(String value)
Checks if the given string is null or has zero length. |
static void |
setProperty(Object bean,
String propertyName,
Object value)
Sets a property at the given bean. |
static String |
toString(Object obj)
Gets the textual representation of the given object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Class[] GETTER_ARG_TYPES
public static final Object[] GETTER_ARGS
| Constructor Detail |
|---|
public BeanUtils()
| Method Detail |
|---|
public static final Object getProperty(Object bean,
String propertyName)
throws BeanException
bean - The bean to read property from.propertyName - The name of the property to read.
BeanException - In case the bean access failed.
public static final Class getPropertyType(Class clazz,
String propertyName,
boolean lenient)
throws BeanException
clazz - The class to determine the property type for.propertyName - The name of the property to read.lenient - If true is passed for this attribute, null will returned for
in case no matching getter method is defined, else an Exception will be throw
in this case.
BeanException - In case the bean access failed.
public static final Object getProperty(Object bean,
String propertyName,
boolean lenient)
throws BeanException
bean - The bean to read property from.propertyName - The name of the property to read.lenient - If true is passed for this attribute, null will returned for
in case no matching getter method is defined, else an Exception will be throw
in this case.
BeanException - In case the bean access failed.
public static final Object invokeGetter(Object bean,
Method getterMethod)
throws BeanException
bean - The bean to set a property at.getterMethod - The setter method to invoke.
BeanException - In case the bean access failed.
public static final void setProperty(Object bean,
String propertyName,
Object value)
throws BeanException
bean - The bean to set a property at.propertyName - The name of the property to set.value - The value to set for the property.
BeanException - In case the bean access failed.
public static final void invokeSetter(Object bean,
Method setterMethod,
Object value)
throws BeanException
bean - The bean to set a property at.setterMethod - The setter method to invoke.value - The value to set for the property.
BeanException - In case the bean access failed.
public static final void invokeSetter(Object bean,
Method setterMethod,
Object value,
TypeConverter typeConverter)
throws BeanException
bean - The bean to set a property at.setterMethod - The setter method to invoke.value - The value to set for the property.typeConverter - The TypeConverter to use.
BeanException - In case the bean access failed.public static final boolean isEmpty(String value)
value - The string to check.
public static final boolean equals(Object a,
Object b)
a - The object to compare with object b.b - The object to compare with object a.
public static final boolean equals(Object a,
Object b,
boolean caseSensitive)
a - The object to compare with object b.b - The object to compare with object a.caseSensitive - Tells whether or not to compare string values case sensitive.
This parameter is only respected, in case a is a java.lang.String instance.
public static final int compare(Comparable a,
Comparable b)
a - The object to compare with object b.b - The object to compare with object a.
public static final boolean between(Comparable obj,
Comparable from,
Comparable to)
obj - The object to check.from - The lower value to compare.to - The upper value to compare.
obj is between from and to.public static final String toString(Object obj)
obj - The object to get the extual representation of.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||