I’m considering to try to do code generation at work. Input is likely to be a JSON Schema.
I guess I could just write the
.java file as a string. But I suspect that would be more error prone than generating a Java AST as some kind of data structure (if only java was homoiconic …). A quick search didn’t reveal any Clojure libraries for working Java AST as data.
Generated code should have:
- appropriate private fields of the right type and with reasonable names
- public getters
- Gson annotations
- an embedded builder class
Anyone done something similar? Suggestions?