public class BeanUtil extends Object
| Constructor and Description |
|---|
BeanUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
copyProperties(Object source,
Object target,
Class<?> editable,
boolean overrideNotBlankProperty,
String... ignoreProperties)
Copy the property values of the given source bean into the given target
bean.
|
static <T> T |
methodInvoke(Method method,
Object target,
Object... args)
使用反射机制执行方法,获取返回值
|
public static <T> T methodInvoke(Method method, Object target, Object... args)
T - 结果类型method - 方法target - 目标对象args - 参数public static void copyProperties(Object source, Object target, @Nullable Class<?> editable, boolean overrideNotBlankProperty, @Nullable String... ignoreProperties) throws org.springframework.beans.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.
source - the source beantarget - the target beaneditable - the class (or interface) to restrict property setting tooverrideNotBlankProperty - source bean 的字段如果有值,是否用 target bean
字段的值覆盖掉ignoreProperties - array of property names to ignoreorg.springframework.beans.BeansException - if the copying failedBeanWrapperCopyright © 2018–2019. All rights reserved.