import java.util.*;
import groovy.lang.*;
import groovy.text.*;
public class Test1 {
public static void main(String[] args) throws Exception {
Map<String, String> binding = new HashMap<String, String>();
binding.put("name", "World");
TemplateEngine engine = new SimpleTemplateEngine();
Writable template = engine.createTemplate("Hello $name!").make(binding);
System.out.println(template.toString());
}
}
import groovy.lang.Binding;
import groovy.lang.GroovyShell;
Binding binding = new Binding();
TestClass newTc = new TestClass();
binding.setVariable("foo", newTc);
GroovyShell shell = new GroovyShell(binding);
shell.evaluate("foo.a=123;");
System.out.println(newTc.a);