All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fitnesse.slim.Jsr223Bridge Maven / Gradle / Ivy

There is a newer version: 20241026
Show newest version
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();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy