views:

35

answers:

2

I'm working on a project where there are two sets of XML schema-generated objects which are two entirely different sets of classes with a similar structure. Conversion between the the two sets consists of a huge amount of boilerplate redundant coding (such as converting elements withing several nested layers of collections).

I'm interested in any reflection or bytecode generation based tool that might be able to take a set of declarative conversion rules and generate the necessary code.

This is for Java.


FYI: I know about commons-beanutils, copyProperties Field names, method names, and contained class types are all different, but at the lowest levels Strings, Enums, Integers and Dates can all be converted simply. A bean-pattern copy will not work.

A: 

Try commons-beanutils. It has

  • BeanUtils.copyProperties(dest, source)
  • converters
Bozho
+1  A: 

I have been using dozer for this and works great. check it out @ http://dozer.sourceforge.net/

Pangea