I have this question. But it will be difficult for me to explain as I don\'t know exact terms to use. Hope someone will understand. I\'ll try to discribe to the best i can.
Did you ever heared about Dozer ? : http://dozer.sourceforge.net/
Dozer
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.
Dozer supports simple property mapping, complex type mapping, bi-directional mapping, implicit-explicit mapping, as well as recursive mapping. This includes mapping collection attributes that also need mapping at the element level.
Dozer allow you to map Java Beans :
Here a XML example on the library site :
org.dozer.vo.TestObject
org.dozer.vo.TestObjectPrime
one
onePrime
This will map object org.dozer.vo.TestObject into TestObjectPrime, mapping all variable that are identicals together (like in your case) and variables TestObjectFoo.oneFoo into TestObjectFooPrime.oneFooPrime.
Great, isn't it ?