| 限定符 | 构造器和说明 |
|---|---|
protected |
JavaBeans() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
copyProperties(Object source,
Object target)
Copy the property values of the given source bean into the target bean.
|
static void |
copyProperties(Object source,
Object target,
Class<?> editable)
Copy the property values of the given source bean into the given target bean,
only setting properties defined in the given "editable" class (or interface).
|
static void |
copyProperties(Object source,
Object target,
String... ignoreProperties)
Copy the property values of the given source bean into the given target bean,
ignoring the given "ignoreProperties".
|
static PropertyDescriptor |
getPropertyDescriptor(Class<?> clazz,
String propertyName)
Retrieve the JavaBeans
PropertyDescriptors for the given property. |
static PropertyDescriptor[] |
getPropertyDescriptors(Class<?> clazz)
Retrieve the JavaBeans
PropertyDescriptors of a given class. |
public static void copyProperties(Object source, Object target) throws BeansException
Note: The source and target classes do not have to match or even be derived from each other, as long as the properties match. Any bean properties that the source bean exposes but the target bean does not will silently be ignored.
This is just a convenience method. For more complex transfer needs, consider using a full BeanWrapper.
source - the source beantarget - the target beanBeansException - if the copying failedpublic static void copyProperties(Object source, Object target, Class<?> editable) throws BeansException
Note: The source and target classes do not have to match or even be derived from each other, as long as the properties match. Any bean properties that the source bean exposes but the target bean does not will silently be ignored.
This is just a convenience method. For more complex transfer needs, consider using a full BeanWrapper.
source - the source beantarget - the target beaneditable - the class (or interface) to restrict property setting toBeansException - if the copying failedpublic static void copyProperties(Object source, Object target, String... ignoreProperties) throws BeansException
Note: The source and target classes do not have to match or even be derived from each other, as long as the properties match. Any bean properties that the source bean exposes but the target bean does not will silently be ignored.
This is just a convenience method. For more complex transfer needs, consider using a full BeanWrapper.
source - the source beantarget - the target beanignoreProperties - array of property names to ignoreBeansException - if the copying failedpublic static PropertyDescriptor[] getPropertyDescriptors(Class<?> clazz) throws BeansException
PropertyDescriptors of a given class.clazz - the Class to retrieve the PropertyDescriptors forPropertyDescriptors for the given classBeansException - if PropertyDescriptor look fails@Nullable public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, String propertyName) throws BeansException
PropertyDescriptors for the given property.clazz - the Class to retrieve the PropertyDescriptor forpropertyName - the name of the propertynull if noneBeansException - if PropertyDescriptor lookup failsCopyright © 2022. All rights reserved.