|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.beanutils.BeanUtils
Utility methods for populating JavaBeans properties via reflection.
The implementations are provided by BeanUtilsBean
.
These static utility methods use the default instance.
More sophisticated behaviour can be provided by using a BeanUtilsBean
instance.
BeanUtilsBean
Field Summary | |
private static int |
debug
Deprecated. BeanUtils now uses commons-logging for all log messages. Use your favorite logging tool to configure logging for this class. |
private static FastHashMap |
dummy
Dummy collection from the Commons Collections API, to force a ClassNotFoundException if commons-collections.jar is not present in the runtime classpath, and this class is the first one referenced. |
Constructor Summary | |
BeanUtils()
|
Method Summary | |
static java.lang.Object |
cloneBean(java.lang.Object bean)
Clone a bean based on the available property getters and setters, even if the bean class itself does not implement Cloneable. |
static void |
copyProperties(java.lang.Object dest,
java.lang.Object orig)
Copy property values from the origin bean to the destination bean for all cases where the property names are the same. |
static void |
copyProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
Copy the specified property value to the specified destination bean, performing any type conversion that is required. |
static java.util.Map |
describe(java.lang.Object bean)
Return the entire set of properties for which the specified bean provides a read method. |
static java.lang.String[] |
getArrayProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified array property of the specified bean, as a String array. |
static int |
getDebug()
Deprecated. BeanUtils now uses commons-logging for all log messages. Use your favorite logging tool to configure logging for this class. |
static java.lang.String |
getIndexedProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified indexed property of the specified bean, as a String. |
static java.lang.String |
getIndexedProperty(java.lang.Object bean,
java.lang.String name,
int index)
Return the value of the specified indexed property of the specified bean, as a String. |
static java.lang.String |
getMappedProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified indexed property of the specified bean, as a String. |
static java.lang.String |
getMappedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.String key)
Return the value of the specified mapped property of the specified bean, as a String. |
static java.lang.String |
getNestedProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the (possibly nested) property of the specified name, for the specified bean, as a String. |
static java.lang.String |
getProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified property of the specified bean, no matter which property reference format is used, as a String. |
static java.lang.String |
getSimpleProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified simple property of the specified bean, converted to a String. |
static void |
populate(java.lang.Object bean,
java.util.Map properties)
Populate the JavaBeans properties of the specified bean, based on the specified name/value pairs. |
static void |
setDebug(int newDebug)
Deprecated. BeanUtils now uses commons-logging for all log messages. Use your favorite logging tool to configure logging for this class. |
static void |
setProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
Set the specified property value, performing type conversions as required to conform to the type of the destination property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static FastHashMap dummy
private static int debug
Constructor Detail |
public BeanUtils()
Method Detail |
public static int getDebug()
public static void setDebug(int newDebug)
public static java.lang.Object cloneBean(java.lang.Object bean) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
Clone a bean based on the available property getters and setters, even if the bean class itself does not implement Cloneable.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.cloneBean(java.lang.Object)
public static void copyProperties(java.lang.Object dest, java.lang.Object orig) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Copy property values from the origin bean to the destination bean for all cases where the property names are the same.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
BeanUtilsBean.copyProperties(java.lang.Object, java.lang.Object)
public static void copyProperty(java.lang.Object bean, java.lang.String name, java.lang.Object value) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Copy the specified property value to the specified destination bean, performing any type conversion that is required.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
BeanUtilsBean.copyProperty(java.lang.Object, java.lang.String, java.lang.Object)
public static java.util.Map describe(java.lang.Object bean) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
Return the entire set of properties for which the specified bean provides a read method.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.describe(java.lang.Object)
public static java.lang.String[] getArrayProperty(java.lang.Object bean, java.lang.String name) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
Return the value of the specified array property of the specified bean, as a String array.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.getArrayProperty(java.lang.Object, java.lang.String)
public static java.lang.String getIndexedProperty(java.lang.Object bean, java.lang.String name) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
Return the value of the specified indexed property of the specified bean, as a String.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.getIndexedProperty(Object, String)
public static java.lang.String getIndexedProperty(java.lang.Object bean, java.lang.String name, int index) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.getIndexedProperty(Object, String, int)
public static java.lang.String getMappedProperty(java.lang.Object bean, java.lang.String name) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.getMappedProperty(Object, String)
public static java.lang.String getMappedProperty(java.lang.Object bean, java.lang.String name, java.lang.String key) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.getMappedProperty(Object, String, String)
public static java.lang.String getNestedProperty(java.lang.Object bean, java.lang.String name) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
Return the value of the (possibly nested) property of the specified name, for the specified bean, as a String.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.getNestedProperty(java.lang.Object, java.lang.String)
public static java.lang.String getProperty(java.lang.Object bean, java.lang.String name) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
Return the value of the specified property of the specified bean, no matter which property reference format is used, as a String.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.getProperty(java.lang.Object, java.lang.String)
public static java.lang.String getSimpleProperty(java.lang.Object bean, java.lang.String name) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
Return the value of the specified simple property of the specified bean, converted to a String.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
BeanUtilsBean.getSimpleProperty(java.lang.Object, java.lang.String)
public static void populate(java.lang.Object bean, java.util.Map properties) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Populate the JavaBeans properties of the specified bean, based on the specified name/value pairs.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
BeanUtilsBean.populate(java.lang.Object, java.util.Map)
public static void setProperty(java.lang.Object bean, java.lang.String name, java.lang.Object value) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Set the specified property value, performing type conversions as required to conform to the type of the destination property.
For more details see BeanUtilsBean
.
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
BeanUtilsBean.setProperty(java.lang.Object, java.lang.String, java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |