|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.script.AbstractScriptEngine
org.jbpm.pvm.internal.script.BshScriptEngine
public class BshScriptEngine
| Field Summary |
|---|
| Fields inherited from class javax.script.AbstractScriptEngine |
|---|
context |
| Fields inherited from interface javax.script.ScriptEngine |
|---|
ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME |
| Constructor Summary | |
|---|---|
BshScriptEngine()
|
|
BshScriptEngine(BshScriptEngineFactory factory)
|
|
| Method Summary | ||
|---|---|---|
javax.script.CompiledScript |
compile(java.io.Reader script)
Compiles the script (source read from Reader) for later
execution. |
|
javax.script.CompiledScript |
compile(java.lang.String script)
Compiles the script (source represented as a String) for later
execution. |
|
javax.script.Bindings |
createBindings()
|
|
java.lang.Object |
eval(java.io.Reader reader,
javax.script.ScriptContext scriptContext)
|
|
java.lang.Object |
eval(java.lang.String script,
javax.script.ScriptContext scriptContext)
|
|
javax.script.ScriptEngineFactory |
getFactory()
|
|
|
getInterface(java.lang.Class<T> clasz)
Returns an implementation of an interface using procedures compiled in the interpreter. |
|
|
getInterface(java.lang.Object thiz,
java.lang.Class<T> clasz)
Returns an implementation of an interface using member functions of a scripting object compiled in the interpreter. |
|
protected bsh.Interpreter |
getInterpreter()
|
|
java.lang.Object |
invokeFunction(java.lang.String name,
java.lang.Object... args)
Used to call top-level procedures defined in scripts. |
|
java.lang.Object |
invokeMethod(java.lang.Object thiz,
java.lang.String name,
java.lang.Object... args)
Calls a procedure compiled during a previous script execution, which is retained in the state of the ScriptEngine |
|
| Methods inherited from class javax.script.AbstractScriptEngine |
|---|
eval, eval, eval, eval, get, getBindings, getContext, getScriptContext, put, setBindings, setContext |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BshScriptEngine()
public BshScriptEngine(BshScriptEngineFactory factory)
| Method Detail |
|---|
protected bsh.Interpreter getInterpreter()
public java.lang.Object eval(java.lang.String script,
javax.script.ScriptContext scriptContext)
throws javax.script.ScriptException
eval in interface javax.script.ScriptEnginejavax.script.ScriptException
public java.lang.Object eval(java.io.Reader reader,
javax.script.ScriptContext scriptContext)
throws javax.script.ScriptException
eval in interface javax.script.ScriptEnginejavax.script.ScriptExceptionpublic javax.script.Bindings createBindings()
createBindings in interface javax.script.ScriptEnginepublic javax.script.ScriptEngineFactory getFactory()
getFactory in interface javax.script.ScriptEngine
public javax.script.CompiledScript compile(java.lang.String script)
throws javax.script.ScriptException
String) for later
execution.
compile in interface javax.script.Compilablescript - The source of the script, represented as a
String.
CompiledScript to be executed later
using one of the eval methods of CompiledScript.
javax.script.ScriptException - if compilation fails.
java.lang.NullPointerException - if the argument is null.
public javax.script.CompiledScript compile(java.io.Reader script)
throws javax.script.ScriptException
Reader) for later
execution. Functionality is identical to compile(String) other
than the way in which the source is passed.
compile in interface javax.script.Compilablescript - The reader from which the script source is obtained.
CompiledScript to be executed
later using one of its eval methods of
CompiledScript.
javax.script.ScriptException - if compilation fails.
java.lang.NullPointerException - if argument is null.
public java.lang.Object invokeMethod(java.lang.Object thiz,
java.lang.String name,
java.lang.Object... args)
throws javax.script.ScriptException,
java.lang.NoSuchMethodException
ScriptEngine.
- Specified by:
invokeMethod in interface javax.script.Invocable
- Parameters:
name - The name of the script method to be called.thiz - thiz is an instance of the script class returned by a previous execution or
invocation, the named method is called through that instance.args - Arguments to pass to the procedure. The rules for converting
the arguments to scripting variables are implementation-specific.
- Returns:
- The value returned by the method. The rules for converting the
scripting variable returned by the procedure to a Java Object are
implementation-specific.
- Throws:
javax.script.ScriptException - if an error occurrs during invocation
of the method.
java.lang.NoSuchMethodException - if method with given name or matching argument
types cannot be found.
java.lang.NullPointerException - if method name is null.
public java.lang.Object invokeFunction(java.lang.String name,
java.lang.Object... args)
throws javax.script.ScriptException,
java.lang.NoSuchMethodException
invokeFunction in interface javax.script.Invocablename - Name of the procedureargs - Arguments to pass to the procedure
javax.script.ScriptException - if an error occurrs during invocation
of the method.
java.lang.NoSuchMethodException - if procedure with given name or matching
argument types cannot be found.
java.lang.NullPointerException - if procedure name is null.public <T> T getInterface(java.lang.Class<T> clasz)
invokeFunction method.
getInterface in interface javax.script.Invocableclasz - The Class object of the interface to return.
ScriptEngine cannot be found matching the ones in the
requested interface.
java.lang.IllegalArgumentException - if the specified Class object
does not exist or is not an interface.
public <T> T getInterface(java.lang.Object thiz,
java.lang.Class<T> clasz)
getInterface in interface javax.script.Invocablethiz - The scripting object whose member functions are used to
implement the methods of the interface.clasz - The Class object of the interface to return.
ScriptEngine cannot be found matching the ones in the
requested interface.
java.lang.IllegalArgumentException - if the specified Class object
does not exist or is not an interface, or if the specified Object is null
or does not represent a scripting object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||