Apache velocity precompiled templates
In the context of Apache's Velocity,
1) Is there any way to, given a template and an "e开发者_如何学运维xample" context, generate Java classes to merge that template with an instance of the "example" context. The idea is to have "precompiled" templates that use strongly typed contexts.
Thanks
Pedro
No. There was talk and some half-hearted efforts at precompiled templates 9 or 10 years ago, but those working on it decided it was not worth the effort. Of course, they were looking at it as a performance goal. No one has seen fit to work on that since.
In fact, i'm not aware of a java-based template language that does support pre-compiling. It's generally not worth it, at least performance-wise. But the idea of doing it for strong-typing enforcement is new to me. I'm not sure that's been much considered.
精彩评论