public interface Script { public int computeResult(int value); }We can use this code to use a script which implements this interface:
ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() {}; Script script = wrapper.getScript(); File file = new File(<our script file>); wrapper.installScript(file); int value = script.computeResult(10);
public interface Script { public int computeResult(int value); }We can use this code to use a script which implements this interface:
ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() {}; wrapper.setExecutionMode(ScriptWrapper.NON_BLOCKING); Script script = wrapper.getScript(); File file = new File(<our script file>); wrapper.installScript(file); wrapper.getScriptProxy.addListener(new ScriptProxyListener() { public void computed(Object result) { System.out.println("The result is: " + (Integer)result); } } script.computeResult(10);
Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence