Adrian,

Adrian Tarau wrote:
What I need is more like calling a template as a function(which behave like a function) in the context of the current execution context(same context, same writer) without too much overhead.

I will try to implement something like that and I will publish the result, maybe it will be useful for somebody else.

I'm thinking that a "tool" is what you're looking for. Since you know what methods you want to call in Velocity -- it's just a matter of calling /them/ instead of something else (like "evaluate"), you could easily write a tool that takes a series of arguments (sounds like you just need the name of the macro to call and a list of arguments of unspecified type) and simply invokes the template with the name matching the first argument.

Since the tool's method is invoked after the Velocity engine resolves the name (i.e. concatenates the string "render" with the name of the component), you can probably write a 1-liner that will do what you want.

-chris

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to