Re: passing list, hash to functions

Attila Szegedi <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
SimpleHash (and HashLiteral, and SequenceHash) are all implementations  
of the TemplateHashModelEx interface. Code to the interface and don't  
assume your code will receive any concrete implementation of the  
interface.

Attila.

On 2008.02.28., at 20:51, dsailer wrote:

> I'm working on custom template functions to convert objects to json  
> so I have:
>
> public class JsonConverter implements TemplateMethodModelEx {
> 	public Object exec(List args) throws TemplateModelException {
>         .....
>          }
> }
>
> when I do this in a template:
>
>                <#assign test3 = {"name":"mouse", "price":50}>
>                ${exec.toJson(test3)}
>
>
> the passed argument is a:
>
> private class SequenceHash implements TemplateHashModelEx
>
> inside of a:
>
> final class HashLiteral extends Expression
>
>
> I guess I was expecting a SimpleHash. I must be doing something  
> wrong here.
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user

Attila.

--
home: http://www.szegedi.org
weblog: http://constc.blogspot.com





-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
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.