Copy property values from the origin bean to the destination bean for all cases where the property names are the same. For each property, a conversion is attempted as necessary. All combinations of standard JavaBeans and DynaBeans as origin and destination are supported. Properties that exist in the origin bean, but do not exist in the destination bean (or are read-only in the destination bean) are silently ignored.
If the origin "bean" is actually a Map
, it is assumed to contain String-valued simple property names as the keys, pointing at the corresponding property values that will be converted (if necessary) and set in the destination bean. Note that this method is intended to perform a "shallow copy" of the properties and so complex properties (for example, nested ones) will not be copied.
This method differs from populate()
, which was primarily designed for populating JavaBeans from the map of request parameters retrieved on an HTTP request, is that no scalar->indexed or indexed->scalar manipulations are performed. If the origin property is indexed, the destination property must be also.
If you know that no type conversions are required, the copyProperties()
method in {@link PropertyUtils} willexecute faster than this method.
FIXME - Indexed and mapped properties that do not have getter and setter methods for the underlying array or Map are not copied by this method.
@param dest Destination bean whose properties are modified @param orig Origin bean whose properties are retrieved @exception IllegalAccessException if the caller does not haveaccess to the property accessor method @exception IllegalArgumentException if thedest
ororig
argument is null or if the dest
property type is different from the source type and the relevant converter has not been registered.
@exception InvocationTargetException if the property accessor methodthrows an exception
|
|
|
|