I try to Bind Variables to Groovy and from Groovy back zu Java:
Java code:
Binding binding = new Binding();
binding.setVariable("SRESULT", "foo");
GroovyShell gs = new GroovyShell(binding);
gs.evaluate(script);
String sResult = (String) gs.getContext().getVariable("SRESULT");
System.out.println("FROM GROOVY: " + sResult);
Groovy Code:
class Est {
static SRESULT
public static void main(String[] args) {
println 'From Java: '+SRESULT
SRESULT = 'bar'
}
}
Output:
From Java: foo
FROM GROOVY: foo
My Question: I want to change SRESULT
in Groovy and have access to the Value in Java.
Can anybody help me?