I am looking for a way to rebuild a compilable java methods from the objects it creates.
I know it is trivial in many contexts to build a Java object using a custom data model and go from the POJO to XML/JSON/YAML/etc and then back to a Java POJO.
Is there a way to go a step further? If I provide the data model and utility classes as a library, can I:
- Create a class that builds an object
- Convert that object into XML
- Send that XML to another user
- Allow them to convert the XML into compilable Java code which, if run, would generate the same XML?
Basically, I want to go back and forth from compilable .java files to XML without loss of information.