public interface Script { public int computeResult(int value); }We could perform:
ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; File file = new File(<our script file>); wrapper.installScript(file);
public interface Script { public int computeResult(int value); }Suppose the following script:
public int computeResult(int value) { return value; } public int anotherMethod(int value) { return value * 2; }We can perform:
ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; File file = new File(<our script file>); wrapper.installScript(file); wrapper.logExceptions(true); Object result = wrapper.invokeMethod("anotherMethod", 1); // result is the Integer 1
Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence