[stringtemplate-interest] Variables in Template Parameters
Brain, Jim
JBrain at Aegonusa.com
Mon Nov 9 14:13:57 PST 2009
What would be the object in this case? The attributes I am trying to use are not in an object, they are attached directly to the template.
Jim
--
Jim Brain, AFP Architecture, 319-355-2070
-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org [mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Terence Parr
Sent: Monday, November 09, 2009 3:31 PM
To: StringTemplate Mailing List
Subject: Re: [stringtemplate-interest] Variables in Template Parameters
Try $object.(attributeHoldingPropertyName)$
Ter
On Nov 9, 2009, at 1:14 PM, Brain, Jim wrote:
> Is there a way to allow $getter$, which is passed "get$name$()" to
> expand $name$ to "Name"?
>
> import org.antlr.stringtemplate.*;
> public class STTest {
> public static void main(String[] args) {
> StringTemplateGroup stg = new StringTemplateGroup
> ("Source");
> stg.defineTemplate("reader","$type$.$getter$");
> StringTemplateGroup stg2 = new StringTemplateGroup
> ("Class");
> stg2.setSuperGroup(stg);
> StringTemplate st = stg2.defineTemplate("prop","$reader
> (getter=\"get$name$()\")$");
> st.setAttribute("name","Name");
> st.setAttribute("type","TYPE");
> System.out.println(st.toString());
> }
> }
>
> When I run this, I get:
>
> TYPE.get$name$()
>
> Which means the attributes are flowing through correctly, but the
> substitution in the parameter is not occurring.
>
> --
> Jim Brain, AFP Architecture, 319-355-2070
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
_______________________________________________
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