public class BeanShellScript extends AbstractScript
RM_DEFAULT, RM_RESULT, RM_SCRIPT, SL_BEANSHELL, SL_DEFAULT, SL_GROOVY, STR_VALUES_FALSE, STR_VALUES_TRUE
Constructor and Description |
---|
BeanShellScript(java.lang.String _src) |
BeanShellScript(java.lang.String _src,
boolean _precompile) |
BeanShellScript(java.lang.String _src,
boolean _precompile,
BeanShellScript _parent) |
BeanShellScript(java.lang.String _src,
boolean _precompile,
BeanShellScript _parent,
java.lang.ClassLoader _classloader) |
BeanShellScript(java.lang.String _src,
boolean _precompile,
BeanShellScript _parent,
java.lang.ClassLoader _classloader,
java.util.Map _initialvars) |
BeanShellScript(java.lang.String _src,
boolean _precompile,
BeanShellScript _parent,
java.lang.ClassLoader _classloader,
java.util.Map _initialvars,
java.util.List<ScriptImport> _defaultImports) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
boolConverter(java.lang.Object o,
java.lang.Object nullValue) |
boolean |
checkNS() |
void |
clear()
Frees all variables of this script after execution to prevent them
from being held "forever" and causing memory leaks.
|
void |
close()
Closes this script instance, freeing up resources.
|
void |
compile()
macht die Syntax-Ueberpruefung
|
void |
compileNT(int _lineOffset,
java.lang.String errorTip)
macht die Syntax-Ueberpruefung aber NoThrow
|
ScriptFunctionI |
createFunction(java.lang.String _src,
java.lang.String[] parmNames,
java.lang.Class[] parmTypes,
java.lang.Class returnType)
Creates a function from a script source string.
|
ScriptFunctionI |
createFunction(java.lang.String _src,
java.lang.String[] parmNames,
java.lang.Class[] parmTypes,
java.lang.Class returnType,
java.lang.String _sn) |
ScriptFunctionI |
createFunction(java.lang.String _src,
java.lang.String[] parmNames,
java.lang.Class[] parmTypes,
java.lang.Class returnType,
java.lang.String _sn,
java.lang.String _fn)
Creates a function from a script source string.
|
ScriptFunctionI |
createFunction(java.lang.String _src,
java.lang.String[] parmNames,
java.lang.Class[] parmTypes,
java.lang.Class returnType,
java.lang.String _sn,
java.lang.String _fn,
int _lineOffset)
Creates a function from a script source string.
|
ScriptFunctionI |
createFunction(java.lang.String _src,
java.lang.String[] parmNames,
java.lang.Class[] parmTypes,
java.lang.Class returnType,
java.lang.String _sn,
java.lang.String _fn,
int _lineOffset,
java.lang.Object _delegate)
Creates a function from a script source string.
|
boolean |
evalAsBoolNT(java.lang.String s,
boolean nullValue,
int _lineOffset,
java.lang.String errorTip)
Evaluates a string as a script with a specified null value and line offset and returns the result as boolean.
|
java.lang.Object |
evalNT(java.lang.String s,
java.lang.Object nullValue,
int _lineOffset,
java.lang.String errorTip)
Evaluates a string as a script with a specified null value and line offset and returns the result as Object.
|
java.lang.Object |
evalNT(java.lang.String s,
java.lang.Object nullValue,
int _lineOffset,
java.lang.String errorTip,
java.util.function.BiFunction typeConverter) |
java.util.Map |
getAllVarMap() |
java.lang.Object |
getAsyncRc() |
java.lang.String |
getImports() |
bsh.Interpreter |
getInterpreter() |
java.lang.String |
getLanguage()
Returns the scripting language of this script instance.
|
int |
getLineOffset() |
java.lang.String |
getMname() |
bsh.NameSpace |
getNs() |
java.lang.String |
getNSName() |
java.lang.Object |
getNT(java.lang.String s,
java.lang.Object exValue)
Gets the value of a variable from the script context.
|
BeanShellScript |
getParent() |
java.lang.String |
getSource()
Returns the source code of this script.
|
java.lang.String |
getSrc() |
boolean |
hasSource()
Checks if this script has source code.
|
boolean |
isCompiled() |
boolean |
isPrecompile() |
boolean |
isSource(java.lang.String s) |
static void |
main(java.lang.String[] args) |
void |
run() |
java.lang.Object |
runAsObjectNT()
Runs the script and returns the result as an object, with
null as default null value. |
java.lang.Object |
runAsObjectNT(java.lang.Object nullValue)
Runs the script with a specified default null value.
|
java.lang.Object |
runAsObjectNT(java.lang.Object nullValue,
int _lineOffset)
Runs the script with a specified null value and line offset.
|
java.lang.Object |
runAsObjectNT(java.lang.Object nullValue,
int _lineOffset,
java.lang.String errorTip)
Runs the script with a specified null value, line offset, and error tip.
|
void |
runNT()
FIXME: lineOffset = wenn das BeanShellScript im Kontext eines grossen Skripts laeuft,
kann man mittels des Offsets die "Startzeile" des aktuellen Skripts mitgeben
|
void |
runNT(int _lineOffset)
Runs the script with a specified line offset.
|
void |
runNT(int _lineOffset,
java.lang.String errorTip)
Runs the script with a specified line offset and error tip.
|
void |
setAsyncRc(java.lang.Object $22) |
void |
setCompiled(boolean $20) |
void |
setImports(java.lang.String $16) |
void |
setInterpreter(bsh.Interpreter $14) |
void |
setLineOffset(int $18)
Sets an offset for line numbers, used for error reporting.
|
void |
setMname(java.lang.String $19) |
void |
setNs(bsh.NameSpace $23) |
void |
setNT(java.lang.String s,
java.lang.Object value,
boolean local)
Sets a variable, optionally with local scope.
|
void |
setParent(BeanShellScript $15) |
void |
setPrecompile(boolean $21)
Sets the pre-compile flag.
|
void |
setSource(java.lang.String _src)
Sets the source code of this script.
|
void |
setSrc(java.lang.String $17) |
asBool, asString, compileNT, compileNT, evalAsBoolNT, evalAsBoolNT, evalAsBoolNT, evalAsStringNT, evalAsStringNT, evalAsStringNT, evalAsStringNT, evalNT, evalNT, evalNT, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInterrupt, getJavaSyntaxImports, getJavaSyntaxImports, getNT, isScriptException, runAsBoolNT, runAsBoolNT, runAsBoolNT, runAsBoolNT, runAsStringNT, runAsStringNT, runAsStringNT, runAsStringNT, setInterrupt, setNT, setNT, setNT, setNT, setNT, setNT, setNT, setNT, setNT, setNT, setNT, setNT
public BeanShellScript(java.lang.String _src)
public BeanShellScript(java.lang.String _src, boolean _precompile)
public BeanShellScript(java.lang.String _src, boolean _precompile, BeanShellScript _parent)
public BeanShellScript(java.lang.String _src, boolean _precompile, BeanShellScript _parent, java.lang.ClassLoader _classloader)
public BeanShellScript(java.lang.String _src, boolean _precompile, BeanShellScript _parent, java.lang.ClassLoader _classloader, java.util.Map _initialvars)
public BeanShellScript(java.lang.String _src, boolean _precompile, BeanShellScript _parent, java.lang.ClassLoader _classloader, java.util.Map _initialvars, java.util.List<ScriptImport> _defaultImports)
public java.lang.String getLanguage()
AbstractScript
getLanguage
in class AbstractScript
public java.lang.String getNSName()
public java.lang.String getSource()
AbstractScript
getSource
in class AbstractScript
public void setSource(java.lang.String _src)
AbstractScript
setSource
in class AbstractScript
_src
- The new source code as a String.public void close()
AbstractScript
close
in class AbstractScript
public void clear()
AbstractScript
clear
in class AbstractScript
public ScriptFunctionI createFunction(java.lang.String _src, java.lang.String[] parmNames, java.lang.Class[] parmTypes, java.lang.Class returnType)
AbstractScript
createFunction
in class AbstractScript
_src
- The script source code.parmNames
- An array of names for the function's parameters.parmTypes
- An array of Class objects representing the types of the function's parameters.returnType
- The Class object representing the return type of the function.ScriptFunctionI
instance representing the created function.public ScriptFunctionI createFunction(java.lang.String _src, java.lang.String[] parmNames, java.lang.Class[] parmTypes, java.lang.Class returnType, java.lang.String _sn)
public ScriptFunctionI createFunction(java.lang.String _src, java.lang.String[] parmNames, java.lang.Class[] parmTypes, java.lang.Class returnType, java.lang.String _sn, java.lang.String _fn)
AbstractScript
createFunction
in class AbstractScript
_src
- The script source code.parmNames
- An array of names for the function's parameters.parmTypes
- An array of Class objects representing the types of the function's parameters.returnType
- The Class object representing the return type of the function._sn
- The name of the script, used for debugging and error reporting._fn
- The name of the function.ScriptFunctionI
instance representing the created function.public ScriptFunctionI createFunction(java.lang.String _src, java.lang.String[] parmNames, java.lang.Class[] parmTypes, java.lang.Class returnType, java.lang.String _sn, java.lang.String _fn, int _lineOffset)
AbstractScript
createFunction
in class AbstractScript
_src
- The script source code.parmNames
- An array of names for the function's parameters.parmTypes
- An array of Class objects representing the types of the function's parameters.returnType
- The Class object representing the return type of the function._sn
- The name of the script, used for debugging and error reporting._fn
- The name of the function._lineOffset
- An integer line offset to use for error reporting.ScriptFunctionI
instance representing the created function.public ScriptFunctionI createFunction(java.lang.String _src, java.lang.String[] parmNames, java.lang.Class[] parmTypes, java.lang.Class returnType, java.lang.String _sn, java.lang.String _fn, int _lineOffset, java.lang.Object _delegate)
AbstractScript
createFunction
in class AbstractScript
_src
- The script source code.parmNames
- An array of names for the function's parameters.parmTypes
- An array of Class objects representing the types of the function's parameters.returnType
- The Class object representing the return type of the function._sn
- The name of the script, used for debugging and error reporting._fn
- The name of the function._lineOffset
- An integer line offset to use for error reporting._delegate
- The object to which the function's method calls will be delegated.ScriptFunctionI
instance representing the created function.public java.util.Map getAllVarMap()
public void run() throws bsh.EvalError
bsh.EvalError
public boolean isSource(java.lang.String s)
public boolean hasSource()
AbstractScript
hasSource
in class AbstractScript
public void runNT()
runNT
in class AbstractScript
public void runNT(int _lineOffset)
AbstractScript
runNT
in class AbstractScript
_lineOffset
- An integer line offset to use for error reporting.public void runNT(int _lineOffset, java.lang.String errorTip)
AbstractScript
runNT
in class AbstractScript
_lineOffset
- An integer line offset to use for error reporting.errorTip
- A string to use as an error message tip if compilation fails.public void compile() throws bsh.EvalError
bsh.EvalError
public void compileNT(int _lineOffset, java.lang.String errorTip)
compileNT
in class AbstractScript
_lineOffset
- An integer line offset to use for error reporting.errorTip
- A string to use as an error message tip if compilation fails.public java.lang.Object runAsObjectNT()
AbstractScript
null
as default null value.runAsObjectNT
in class AbstractScript
public java.lang.Object runAsObjectNT(java.lang.Object nullValue)
AbstractScript
runAsObjectNT
in class AbstractScript
nullValue
- The value to return if the script returns null.public java.lang.Object runAsObjectNT(java.lang.Object nullValue, int _lineOffset)
AbstractScript
runAsObjectNT
in class AbstractScript
nullValue
- The value to return if the script returns null._lineOffset
- An integer line offset to use for error reporting.public java.lang.Object runAsObjectNT(java.lang.Object nullValue, int _lineOffset, java.lang.String errorTip)
AbstractScript
runAsObjectNT
in class AbstractScript
nullValue
- The value to return if the script returns null._lineOffset
- An integer line offset to use for error reporting.errorTip
- A string to use as an error message tip if compilation fails.public boolean checkNS()
public void setNT(java.lang.String s, java.lang.Object value, boolean local)
AbstractScript
setNT
in class AbstractScript
s
- The name of the variable to set.value
- The value of the variable to set.local
- A flag indicating if the variable shall have a local scope.public java.lang.Object getNT(java.lang.String s, java.lang.Object exValue)
AbstractScript
getNT
in class AbstractScript
s
- The name of the variable to retrieve the value of.exValue
- This parameter is unused in all implementing classes. Maybe it was once intended to be a default value?public java.lang.Object evalNT(java.lang.String s, java.lang.Object nullValue, int _lineOffset, java.lang.String errorTip)
AbstractScript
evalNT
in class AbstractScript
s
- The source of the script to evaluate.nullValue
- The value to return if the evaluation returns null._lineOffset
- An integer line offset to use for error reporting.errorTip
- A string to use as an error message tip if evaluation fails.public java.lang.Object evalNT(java.lang.String s, java.lang.Object nullValue, int _lineOffset, java.lang.String errorTip, java.util.function.BiFunction typeConverter)
public boolean evalAsBoolNT(java.lang.String s, boolean nullValue, int _lineOffset, java.lang.String errorTip)
AbstractScript
evalAsBoolNT
in class AbstractScript
s
- The source of the script to evaluate.nullValue
- The value to return if the evaluation returns null._lineOffset
- An integer line offset to use for error reporting.errorTip
- A string to use as an error message tip if evaluation fails.public java.lang.Object boolConverter(java.lang.Object o, java.lang.Object nullValue)
public static void main(java.lang.String[] args)
public bsh.Interpreter getInterpreter()
public void setInterpreter(bsh.Interpreter $14)
public BeanShellScript getParent()
public void setParent(BeanShellScript $15)
public java.lang.String getImports()
public void setImports(java.lang.String $16)
public java.lang.String getSrc()
public void setSrc(java.lang.String $17)
public int getLineOffset()
public void setLineOffset(int $18)
AbstractScript
setLineOffset
in class AbstractScript
$18
- The line offset.public java.lang.String getMname()
public void setMname(java.lang.String $19)
public boolean isCompiled()
public void setCompiled(boolean $20)
public boolean isPrecompile()
public void setPrecompile(boolean $21)
AbstractScript
setPrecompile
in class AbstractScript
$21
- The boolean value for the pre-compile flag.public java.lang.Object getAsyncRc()
public void setAsyncRc(java.lang.Object $22)
public bsh.NameSpace getNs()
public void setNs(bsh.NameSpace $23)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.