[stringtemplate-interest] Conditional access to Map attribute
Tommy C. Li
tommycli at ucla.edu
Thu Jan 14 18:59:37 PST 2010
I was passing in a Scala MapWrapper that was interface compatible with
the java Map.
It worked when I just passed in the underlying Java HashMap.
Thanks dude,
Tommy
Terence Parr wrote:
> weird. that should work fine. You sure it's a Map?
> Ter
> On Jan 13, 2010, at 10:31 PM, Tommy C. Li wrote:
>
>> Here's basically what I want to do:
>>
>> $if(metadata.description)$
>> <br />
>> $metadata.description$
>> $endif$
>>
>> Where "metadata" is a Map passed in. "metadata" may or may not contain
>> "description" as a key. If it does not, I hope to have it print nothing.
>>
>> Right now I get:
>>
>> Class com.keepword.render.MyJCL$$anon$1 has no such attribute:
>> description in template context [short]
>> java.lang.NoSuchFieldException: description
>>
>> What's the proper way to accomplish this in ST?
>>
>> Tommy
>>
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
More information about the stringtemplate-interest
mailing list