public final class BeanUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
copyProperties(Object dest,
Object source)
Copies all bean properties from the source bean to the destination.
|
static void |
copyProperty(Object bean,
String name,
Object value)
Copy the specified property value to the specified destination bean.
|
static Map<String,String> |
describe(Object bean)
Describes the properties to the specified destination bean.
|
static String[] |
getArrayProperty(Object bean,
String name)
Returns an array property as string array.
|
static String |
getProperty(Object bean,
String name)
Returns the named property value for the given bean.
|
static Object |
getRawProperty(Object bean,
String name)
Returns the raw named property value for the given bean.
|
static String |
getSimpleProperty(Object bean,
String name)
Returns the simple property value for the given bean.
|
static boolean |
initCause(Throwable throwable,
Throwable cause)
Initialized the cause of a throwable.
|
static void |
populate(Object bean,
Map<String,? extends Object> properties)
Populates a bean with the given values.
|
static void |
setProperty(Object bean,
String name,
Object value)
Sets the named property on the given bean.
|
public static void copyProperties(Object dest, Object source) throws IllegalAccessException, InvocationTargetException
dest
- the destination beansource
- the source beanIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionpublic static void copyProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException
bean
- the bean on which setting is to be performedname
- the property namevalue
- the value to be setIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionpublic static Map<String,String> describe(Object bean) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
bean
- the bean on which description is performedIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionNoSuchMethodException
- the accessor method for the property cannot be foundpublic static String[] getArrayProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
bean
- the bean on which the operation is to be performedname
- the property nameIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionNoSuchMethodException
- the accessor method for the property cannot be foundpublic static String getProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
bean
- the bean on which the operation is to be performedname
- the property nameIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionNoSuchMethodException
- the accessor method for the property cannot be foundpublic static Object getRawProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
bean
- the bean on which the operation is to be performedname
- the property nameIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionNoSuchMethodException
- the accessor method for the property cannot be foundpublic static String getSimpleProperty(Object bean, String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
bean
- the bean on which the operation is to be performedname
- the property nameIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionNoSuchMethodException
- the accessor method for the property cannot be foundpublic static void populate(Object bean, Map<String,? extends Object> properties) throws IllegalAccessException, InvocationTargetException
bean
- the bean on which the operation is to be performedproperties
- the property valuesIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionpublic static void setProperty(Object bean, String name, Object value) throws IllegalAccessException, InvocationTargetException
bean
- the bean on which the operation is to be performedname
- the property namevalue
- the property valueIllegalAccessException
- the caller can't invoke the target's property accessor methodInvocationTargetException
- the target's property accessor method has thrown an exceptionCopyright © 2016 Lexmark Enterprise Software Deutschland GmbH. All rights reserved.