Re: Deprecation in data model
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, December 30, 2009, 3:57:36 PM, Ista Pouss wrote:
> Hey,
>
> I have a term in the data model, for instance "term", and I use in
> model ${term}, all is good.
>
> But now I should want use "word" because I don't like "term" anymore.
> And when I use term in a model, I should want freemarker say to me, in
> a log, "Hey you don't like 'term', it's deprecated, use 'word' at line
> xyz of template foo.ftl". And, of course, freemarker use "term" as
> usual.
>
> Is it possible to do that, and how ?
As far as FreeMarker is concerned, yes, but it's always a question if
the framework your are using gives sufficiently low-level access to
FreeMarker... Anyway, if it does, since "term" is a top-level data,
you could use a custom TemplateHashModel implementation that does
this. (If are using a java.util.Map as the data-model root, you could
wrap it into your TemplateHashModel implementation just before passing
to the template.process call)
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev