*/
public static void main(final String[] args) throws InstantiationException, Exception {
Binding binding = new Binding();
binding.setVariable("foo", new Integer(2));
GroovyShell shell = new GroovyShell(binding);
Script script = shell.parse("service.with{sru()} ;x = 123; return foo * 10;");
MetaClass metaClass = script.getMetaClass();
Binding binding2 = script.getBinding();
// Object property = script.getProperty("service");
script.setProperty("service", new CustomerService() {
@Override
public void sru() {
System.out.println("sruuu");
}
});
script.run();
String fileName = "src/main/java/Tester.groovy";
GroovyClassLoader gcl = new GroovyClassLoader();
Class clazz = gcl.parseClass(new File(fileName));
Field[] fields = clazz.getFields();