fitnesse.slim.Jsr223Bridge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fitnesse Show documentation
Show all versions of fitnesse Show documentation
The fully integrated standalone wiki, and acceptance testing framework.
package fitnesse.slim;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.io.Closeable;
import java.io.IOException;
public abstract class Jsr223Bridge {
private ScriptEngine engine;
public abstract Object getStatementExecutor();
public abstract Object invokeMethod(Object thiz, String name, Object... args)
throws Exception;
public ScriptEngine getScriptEngine() {
if (engine == null) {
engine = new ScriptEngineManager().getEngineByName(getEngineName());
}
return engine;
}
public void close() {
try {
((Closeable)getScriptEngine()).close();
} catch (IOException e) {
e.printStackTrace();
}
}
public abstract String getEngineName();
}