In Jodd BeanUtil
class does not have a method that will copy data from one object to another, i.e. in apache commons BeanUtils
class there is a method copyProperties
that will copy data from one object to another.
In Jodd we have to pass the name of the field and its value. If there are like 20+ fields do we have to do this manually for all the 20 fields or is there a better way of doing it using Jodd BeanUtil
.
Actually, there is such tool in Jodd - its just in different class:
BeanCopy
(javadoc). This class offers some more control over copy process, like including/exluding some properties and so on. It was too big to put all this functionality in theBeanUtil
:)Take a look at the test sources, you will find many examples there. Here are some quick examples:
and so on.