Code generators are expensive to create and adapting existing generators to fit your needs may be extremly difficult and complex. This is the reason why code generators are used relatively rarely for real-world software development projects.
g2mat goes a new way and generates code generators automatically from existing source code. This makes code generators very easy to create, maintain and adapt.
This graphic describes how this works:
The significant advantage of this idea is the easy and very flexible art of code generation. g2mat covers all the know-how and the expensive work of creating code generators. You do not have to deal with difficult-to-read and error-prone generation templates nor with complex code generation frameworks. Every developer and architect can change the generation templates and the architecture of the generated application. You can get some more insights about the advantages at http://www.methodsandtools.com/tools/generjee.php.
Let’s see two examples of public code generators created with this approach.
generjee
generjee is a free online generator for Java EE applications. It generates the source code of data-oriented applications according to an entity-relationship-model and a user-defined application design.
J To Go
J To Go is an online wrapper of the most known and most powerful Java generator JHipster. J To Go was generated from real source code generated by JHipster. You can find the original source code at https://github.com/j-to-go/j-to-go-source and the generated generator at https://github.com/j-to-go/j-to-go-generator. This was made to test g2mat's abilities with a powerful and comprehensive source application. The by-product of this test is J To Go, which was provided to the community as an experimental lightweight online JHipster-like generator. The generated generator needs to run on a platform which provides a web interface and a command line to use the generator. This platform is a quick-hacked experimental system that you can find at https://github.com/j-to-go/generator-platform.