In my current project I'm using deferred binding to generate code. The code 
generation is heavily based on writer.write(String), writer.indent() and 
writer.outdent(): 

writer.write("%s = new %s<%s>();", var1, collectionImplementation, paramType
);
writer.write("for (Element %s : %s) {", elementVariable, elementsVariable);
writer.indent();
writer.write("if (%s != null) {", valueVariable);
writer.indent();
writer.write("%s.add(%s);", valueVariable, valueVariable);
writer.outdent();
writer.write("}");
writer.outdent();
writer.write("}");

The whole process became very complex and error-prone. I'm thinking about to 
use velocity templates. Has anyone already used velocity templates for 
code generation? Is this a good idea? What do you think?

- Harald 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to