public final class PropertyUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <Bean> void |
copyProperties(Bean dest,
Bean source)
This method copies the properties of the given source bean to the target bean.
|
static void |
copyPropertiesUntyped(Object dest,
Object source)
This method copies the properties of the given source object to the target object.
|
static Map<String,Object> |
describe(Object bean)
This method describes the given bean.
|
static Object |
getProperty(Object bean,
String name)
This method gets the beans property with the given name.
|
static <Bean> void |
merge(Bean changes,
Bean target)
This method merges the given changes to the given bean.
|
static <Bean> Bean |
merge(Bean base,
Bean changes,
Bean target)
This method merges the given changes to the given bean to the target bean.
|
static void |
setProperty(Object bean,
String name,
Object value)
This method sets the given beans property with the given name to the given value.
|
public static Map<String,Object> describe(Object bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException
bean - the bean to describeIllegalAccessException - 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 getProperty(Object bean, String name) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException
bean - the bean to get the property fromname - the name of the propertyIllegalAccessException - 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 setProperty(Object bean, String name, Object value) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException
bean - the bean to set the property ofname - the name of the propertyvalue - the value to setIllegalAccessException - 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 <Bean> Bean merge(Bean base,
Bean changes,
Bean target)
throws IllegalAccessException,
NoSuchMethodException,
InvocationTargetException
null values in
changes will not override values from base every other value will be taken from
changes.Bean - the bean typebase - the values to use for null-properties in changeschanges - the changes to merge to basetarget - the merged propertiesIllegalAccessExceptionNoSuchMethodExceptionInvocationTargetExceptionpublic static <Bean> void merge(Bean changes,
Bean target)
throws IllegalAccessException,
NoSuchMethodException,
InvocationTargetException
null values in
changes will not override values from target every other value will be taken from
changes.Bean - the bean typechanges - the changes to merge to basetarget - the merged propertiesIllegalAccessExceptionNoSuchMethodExceptionInvocationTargetExceptionpublic static <Bean> void copyProperties(Bean dest,
Bean source)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
Bean - the type of both argumentsdest - the bean to copy tosource - the bean to copy fromIllegalAccessExceptionInvocationTargetExceptionNoSuchMethodExceptionpublic static void copyPropertiesUntyped(Object dest, Object source) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
dest - the bean to copy tosource - the bean to copy fromIllegalAccessExceptionInvocationTargetExceptionNoSuchMethodExceptionCopyright © 2016 Lexmark Enterprise Software Deutschland GmbH. All rights reserved.