[stringtemplate-interest] ST4: StaticMethodModelAdaptor
Terence Parr
parrt at cs.usfca.edu
Sat Jan 22 12:50:46 PST 2011
On Jan 21, 2011, at 5:57 PM, Collin Fagan wrote:
> Hi All,
>
> While playing around with model adaptors I wrote one that "adds" properties to a type from a static utility class. This ends up being something like a "mix-in" or groovys meta-programming. Say you have a String in a template variable called "string" and that variable had the value "hello world". Using the StaticMethodModelAdaptor you could add all the compatible methods from org.apache.commons.lang.StringUtils to String and call them from your template.
>
> Then <string.capitalise> would output: Hello world.
hi Collin,Does this call getCapitalise() on your adapter object?
Ter
More information about the stringtemplate-interest
mailing list