0

I'm trying to use StringTemplate to be able to parse some configuration file inputs, and was wondering if it was possible to register a renderer without using STGroup.

Example (but the registerRenderer method seems to be missing from the library):

ST myST = new ST("Hello, <thing>!");
myST.add("thing", new Thing());
myST.registerRenderer(Thing.class, new ThingRenderer());
return myST.render();
Burg
  • 1,988
  • 1
  • 18
  • 22

1 Answers1

1

Actually after posting this, the answer came to me.

STGroup myGroup = new STGroup();
myGroup.registerRenderer(Thing.class, new ThingRenderer());
ST myST = new ST(myGroup, "Hello, <thing>!");
myST.add("thing", new Thing());
return myST.render();
Burg
  • 1,988
  • 1
  • 18
  • 22