//see: http://groovy.codehaus.org/Embedding+Groovy Binding binding = new Binding(); binding.setVariable("foo", 2); GroovyShell shell = new GroovyShell(binding); Object value = shell.evaluate("println 'Hello World!'; x = 123; return foo * 10"); assert value.equals(20); assert binding.getVariable("x").equals(123);
No comments:
Post a Comment