public class EvalJavaBsh
extends java.lang.Object
This class is thread-safe, but be warned: if multiple threads are hammering the bean shell for evaluations, it will slow down a lot due to contested locks.
| Modifier and Type | Field and Description |
|---|---|
static EvalJavaBsh |
evalJavaBsh
the singleton object of this class.
|
| Constructor and Description |
|---|
EvalJavaBsh()
the contructor
|
| Modifier and Type | Method and Description |
|---|---|
static void |
displayCell(Cell cell)
Display specified Cell after termibation of currently running script
|
java.lang.Object |
doEvalLine(java.lang.String line) |
protected java.lang.Object |
evalVarObject(CodeExpression ce,
VarContext context,
java.lang.Object info)
Evaluate Object as if it were a String containing java code.
|
VarContext |
getCurrentContext()
See what the current context of eval is.
|
java.lang.Object |
getCurrentInfo()
See what the current info of eval is.
|
java.lang.Object |
getVariable(java.lang.String name) |
boolean |
isValidJava(java.lang.String line)
Method to determine whether a string is valid Java code.
|
java.lang.Object |
P(java.lang.String name)
Method to lookup a variable for evaluation.
|
java.lang.Object |
PAR(java.lang.String name)
Method to lookup a variable for evaluation.
|
static java.lang.String |
replace(java.lang.String expr)
Replaces @var calls to P("var")
Replaces P("var") calls to P("ATTR_var")
Replaces PAR("var") calls to PAR("ATTR_var")
|
static void |
runScript(java.lang.String script)
Run a Java Bean Shell script
|
static Job |
runScriptJob(java.lang.String script)
Run a Java Bean Shell script
|
void |
setVariable(java.lang.String name,
java.lang.Object value)
Set a variable in the Java Bean Shell
|
public static final EvalJavaBsh evalJavaBsh
public VarContext getCurrentContext()
public java.lang.Object getCurrentInfo()
public static java.lang.String replace(java.lang.String expr)
expr - the expressionprotected java.lang.Object evalVarObject(CodeExpression ce, VarContext context, java.lang.Object info) throws VarContext.EvalException
ce - the CodeExpression to be evaluates.context - the context in which the object will be evaluated.info - used to pass additional info from Electric to the interpreter, if needed.VarContext.EvalExceptionpublic java.lang.Object P(java.lang.String name)
throws VarContext.EvalException
name - the name of the variable to find.VarContext.EvalExceptionpublic java.lang.Object PAR(java.lang.String name)
throws VarContext.EvalException
name - the name of the variable to find.VarContext.EvalExceptionpublic static void runScript(java.lang.String script)
public static void displayCell(Cell cell)
cell - public static Job runScriptJob(java.lang.String script)
public void setVariable(java.lang.String name,
java.lang.Object value)
name - the name of the variablevalue - the value to set the variable topublic java.lang.Object getVariable(java.lang.String name)
public java.lang.Object doEvalLine(java.lang.String line)
public boolean isValidJava(java.lang.String line)
line - the string to test.