1

I need to copy the properties from one bean to another with same properties names. I found the class BeanUtils and method copyProperties(). The problem is that in my beans there are nested objects. So I tried to create a custom converter (implementing Converter interface) but I don't know how to map objects inside other objects and I don't know what I have to put inside the implementation of method convert(). I haven't found any solution for this problem.

Can you help me?

Regards.

Giorgio
  • 41
  • 5
  • copyProperties will make a shallow copy. I guess you want a deep copy. I suggest you do a search on deep copy in stack overflow. One discussion of deep copies is http://stackoverflow.com/a/15591144/4387162 – downeyt Jul 17 '15 at 20:31

1 Answers1

1

have a look at http://dozer.sourceforge.net/ Dozer is a Java Bean to Java Bean mapper that recursively copies data from one object to another. Typically, these Java Beans will be of different complex types.

learningJava
  • 190
  • 6