Is it possible to marshall java objects tree to source code, that generates the tree?
What I am trying to do is to create sample data for integration testing from live data. I need to serialize sample objects (i.e. JPA entities) to a human readable form, tweak it and prepare integration tests.
It would be great if something created java code from given object tree.
The structure is quite complex, with two-way references etc. I tried XStream to XML serialization but it fails on two-way references. I tried JAXB too but it seems that it does not support cyclic references at all.
//EDIT:
Actually I've managed to get XStream running. However the question is : Is there a library that can generate a source code from given object tree?