Script
interface:public interface Script { public int execute(); }To create the wrapper, you must use a PythonScriptWrapper:
ScriptWrapper<Script> wrapper = new PythonScriptWrapper<Script>(){ }; Script script = wrapper.getScript(); File file = new File(<our script file>); wrapper.installScript(file); int value = script.execute();You can use for example the following script:
def execute(self): return 10
from my.package import *To work around this problem, the library will try to get all the classes defined in a package in the ClassLoader, which means that if you have:
wrapper.import("my.package.*");You will effectively create constructs like:
from my.package import ClassA from my.package import ClassB ...However this will not work for the JDK class library which means that for example this will not work:
wrapper.import("java.util.*");
Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence