DebuggingWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; File file = <the script> wrapper.installScript(file); // install the script wrapper.initializeDebugSession(); // initialize the Debug session DebugSession<Script> session = wrapper.createDebugSession(); SessionHook<Script> hook = ...If the script is not compilable, an exception will be thrown. But the following code will work correctly:
DebuggingWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; File file = <the script> wrapper.initializeDebugSession(); // initialize the Debug session wrapper.installScript(file); // install the script DebugSession<Script> session = wrapper.createDebugSession(); SessionHook<Script> hook = ...
DebuggingWrapper
s.DebuggingWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; File file = <the script> wrapper.initializeDebugSession(); // initialize the Debug session wrapper.installScript(file); // install the script // create the session DebugSession<Script> session = wrapper.createDebugSession();Note that the session will only start after the DebugSession.startSession() has been called.
public interface Script { public int compute() { } }We can perform:
DebuggingWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; File file = <the script> wrapper.initializeDebugSession(); wrapper.installScript(file); DebugSession<Script> session = wrapper.createDebugSession(); SessionHook<Script> hook = new SessionHook<> { public Object start(Script script) { return script.compute(); } } session.setSessionHook(hook);
DebuggingWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { }; File file = <the script> wrapper.initializeDebugSession(); wrapper.installScript(file); DebugSession<Script> session = wrapper.createDebugSession(); SessionHook<Script> hook = new SessionHook<> { public Object start(Script script) { return script.compute(); } } session.setSessionHook(hook); session.startSession(); session.startScript(); // here the script.compute() method is effectively executed
Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence