Re: Can dereferencing semantics be disabled?

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Wednesday, February 17, 2010, 10:13:20 PM, kbutler wrote:

> Hi - this is a silly question and I apologize in advance, but I must ask it.
>
> I know that the "." character is a dereferencing operator when used in a
> variable name;
>
> for example
>     ${employee.id)
>
> I believe translates to 
>     employee.getId()  (more or less)
>
> as it would in OGNL.   
>
> Is it possible to either disable this dereferencing and treat token
> 'employee.id'  as a simple, unparsed variable name, OR to change the "."
> syntax to some other character? 

No, not without modifying the source code of FreeMarker.

Unless, you write a TemplateLoader that does the necessary source code
transformations (foo.bar to .vars["foo.bar"]), but that's not just
some kind of simple search-and-replace, as it has to understand the
syntax somewhat. Also then the error messages would still use the
original FreeMarker syntax, and displaced column numbers.

> Thanks - 
> Kent

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Download Intel&reg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.