BeanUtils copyProperties

copyProperties

public static void copyProperties(Object source, Object target) throws 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.

public static void copyProperties(Object source, Object target, Class<?> editable) throws 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.
public static void copyProperties(Object source, Object target, String[] ignoreProperties) throws 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.

 

posted @ 2013-01-05 16:25  Onakaumi  阅读(835)  评论(0编辑  收藏  举报