Class LegacySpringBeanUtil
BeanUtils.copyProperties(Object, Object)
, fork from spring-framework 5.2.24,
the copy property method will not check ResolvableType.
- Version:
- LegacySpringBeanUtil.java, v 0.1 2023年05月25日 5:36 PM huzijie Exp $
- Author:
- huzijie
- See Also:
-
BeanUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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".
-
Constructor Details
-
LegacySpringBeanUtil
public LegacySpringBeanUtil()
-
-
Method Details
-
copyProperties
public static void copyProperties(Object source, Object target) throws org.springframework.beans.BeansException Copy the property values of the given source bean into the target bean.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.
- Parameters:
source
- the source beantarget
- the target bean- Throws:
org.springframework.beans.BeansException
- if the copying failed
-
copyProperties
public static void copyProperties(Object source, Object target, Class<?> editable) throws org.springframework.beans.BeansException 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).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.
- Parameters:
source
- the source beantarget
- the target beaneditable
- the class (or interface) to restrict property setting to- Throws:
org.springframework.beans.BeansException
- if the copying failed
-
copyProperties
public static void copyProperties(Object source, Object target, String... ignoreProperties) throws org.springframework.beans.BeansException Copy the property values of the given source bean into the given target bean, ignoring the given "ignoreProperties".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.
- Parameters:
source
- the source beantarget
- the target beanignoreProperties
- array of property names to ignore- Throws:
org.springframework.beans.BeansException
- if the copying failed
-