Are Map keys cached?

Jeremy Chone <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hi,
Using BeansWrapper.DEFAULT_WRAPPER, do the Map keys get cached by the Map
bean wrapper?

I have a use case where I would like to evaluate the keys dynamically for
each template call. The current idea would be to create a Java class that
implements Map and override the get() methods to implement the desired
logic. The expected behavior would be that for each template call to a
property (e.g., ${mySuperMap.dynaProperty}) it will call the override get()
method and return the desired value. In this use-case the list of keys is
dynamic and cannot be known ahead of time.

Now, if the default Map bean wrapper cache the keys or values, this model
would not work.

So, does the Default Map Wapper bean cache the keys at any point? If yes, what
would be the best way to accomplish my requirement?

I understand that I could have implement a custom get properties (e.g.
getProp(...)) and call it in the template. However, for template readability
I would prefer to use the object.property notation.


Thank you.

Jeremy,

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
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.