Code Generation
September 13th, 2002 by HenI’m seeing various projects out there doing code generation, commons-sql being one of them, so I guess it’s time I dug out GJGeneration from its careful constructed cocoon and started to fulfill the promise of its grandiose design.
Currently it takes XML, my own ObjectModel [which can be scripted] notation as input. There is an untested MetaModel input from Internation’s old metamodel [my old company], and half-coded CSV and JDBC inputs. The CSV input was the one that beat me, CSV is just too bloody painful to store an object model. I need to add Doclets if possible. The doclet API is a bit weak, but I think I figured out a way to hack it across.
On the output side, it only outputs to Java and vaguely to Html. Which was never really in the plan. So I need to add Ruby, CSharp, XML, JSP etc.
On the templating side, it only has the rather difficult GJT language. While I like the fact that GJT embeds XML in Java and not vice versa, thus making nice templates, it is a pain to parse and isn’t something I really want to continue growing. Instead I’d like to sit on top of Velocity, BeanShell, and really any good scripting language
JSP? JPython? Java?
At some point, hopefully it would gain enough momentum that people would realise that a framework for code generation is damn cool. Switching from a JDBC source to a Doclet source would require nothing but supplying the raw material. A template written in velocity could happily be outputting along side one in BeanShell. Having Velocity able to import the BeanShell import would be very nice, but would probably involve hacking each scripting language.
Anyways. Enthused to take GJGen to the next step. Brief explanation available at the GJGen webpage.
