Nov 17th, 2009, 10:04 AM
Code generation Architecture
First of all, congratulations for this excellent project.
After analyzing the add-ons included on Spring Roo it seems that it doesn't use templates for code generation, using a programatic approach.
Am I right? Is there any special reason for that?
We are going to develop a custom add-on and we would like to use Freemarker for code generation.
Nov 17th, 2009, 06:29 PM
Earlier versions of Roo used FreeMarker for source code generation. But if you look at the code, you'll find such a tiny percentage of the code generation related code is of a template nature, it just adds an extra layer of complexity and performance hit for very little value. If you look at say our EntityMetadata source code, you'll find usage of the InvocableMemberBodyBuilder (which would be the only area which is sufficiently template compatible to be a candidate for something like FreeMarker) it is a very small percentage of the overall class. The other consideration is we heavily use metadata concepts to allow intelligent and automatic modification of the resulting types, and templates are basically too crude to support this level of flexibility.