|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.electric.database.variable.EvalJavaBsh
public class EvalJavaBsh
Used for evaluating Java expressions in Variables It is meant to be invoked from the Variable context; these methods should not be used from other contexts, and thus are declared protected.
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.
Field Summary | |
---|---|
static EvalJavaBsh |
evalJavaBsh
the singleton object of this class. |
Constructor Summary | |
---|---|
EvalJavaBsh()
the contructor |
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final EvalJavaBsh evalJavaBsh
Constructor Detail |
---|
public EvalJavaBsh()
Method Detail |
---|
public VarContext getCurrentContext()
public java.lang.Object getCurrentInfo()
public static java.lang.String replace(java.lang.String expr)
expr
- the expression
protected 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.EvalException
public java.lang.Object P(java.lang.String name) throws VarContext.EvalException
name
- the name of the variable to find.
VarContext.EvalException
public java.lang.Object PAR(java.lang.String name) throws VarContext.EvalException
name
- the name of the variable to find.
VarContext.EvalException
public static void runScript(java.lang.String script)
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |