Calling object method with no parameters without parentheses in template
Dmitry Bondarenko <[email protected]> Wed, 16 Oct 2013 10:50:11 +0300
| Newsgroups | gmane.comp.web.freemarker.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, a question/request for Freemarker developers.
We're using Freemarker in many projects developed by our company. We
really like it, it fits well for our needs, but there is one thing we'd
like to ask/request: calling object method with no parameters without
parentheses in templates. E.g.:
public class Foo {
public int bar() { return 1; }
}
we'd like to call bar() without () inside templates:
${Foo.bar} instead of ${Foo.bar()}
We tried to do that with DefaultObjectWrapper, but it wraps bar() into
MethodTemplateModel and tells it could not be displayed in template.
We'd like to have a Freemarker capability to call ${Foo.bar} (without
parentheses) from template and display evaluated method results. (Just a
clarification: we'd like to have this ability as Freemarker feature (out
of the box), without need to implement custom ObjectWrapper for our needs).
Cheers, Dmitry.
--
Best regards, Dmitry Bondarenko
Anadea Inc
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk