[stringtemplate-interest] Using StringTemplate with Java, may be obvious

Terence Parr parrt at cs.usfca.edu
Sat Sep 5 14:27:55 PDT 2009


On Sep 5, 2009, at 1:41 PM, Chris Gerrard wrote:

> Can I simply pass a Java object (JavaBean perhaps) along and have  
> StringTemplate interrogate it for the properties to substitute into  
> the template?

sure.  <o.methods> or <o.fields>.

> I'm just starting with StringTemplate and can't find this in the  
> doc, even if it's a legitimate use of StringTemplate.

i'd avoid it for large projects; use a model to traverse reflection  
api and pass in data you need.

> I'd rather not have to write the mechanical code to simply pull  
> property values from the Java object and set them with  
> setAttribute(...)

works great for small examples.

T


More information about the stringtemplate-interest mailing list