public interface Script { }This code is perfectly valid:
ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { };
public int computeResult(int value) { return value * 10; }You won't be able to compile:
ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; File file = new File(<our script file>); wrapper.installScript(file); int value = script.computeResult(10);Because the
computeResult(int value)
does not exist in the script.
File file = new File(<our script file>); wrapper.installScript(file); wrapper.logExceptions(true); Object result = wrapper.invokeMethod("computeResult", 1); // result is the Integer 1
Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence