public abstract class AbstractScriptHelper extends Object implements ScriptHelper
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
AbstractScriptHelper() |
Modifier and Type | Method and Description |
---|---|
Object |
call(Object obj,
String methodCall)
Call a method on the given object.
|
protected Object |
doCall(Object obj,
String methodCall) |
Object |
eval(String expr)
Evaluate the given expression.
|
Bindings |
getBindings()
Get current script bindings.
|
void |
setBindings(Bindings bindings)
Set script bindings.
|
boolean |
test(String expr)
Evaluate a boolean expression.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
eval
public Bindings getBindings()
ScriptHelper
getBindings
in interface ScriptHelper
public void setBindings(Bindings bindings)
ScriptHelper
setBindings
in interface ScriptHelper
bindings
- new script bindings.public final boolean test(String expr)
ScriptHelper
test
in interface ScriptHelper
expr
- a boolean expressionpublic Object call(Object obj, String methodCall)
ScriptHelper
The methodCall is a string expression containing arguments to be passed. For example:
scriptHelper.call(bean, "test(var1, var2, var3)");This is a convenient method to call:
scriptHelper.call(bean, "test", new Object[] { var1, var2, var3 });
call
in interface ScriptHelper
obj
- the object on which method should be calledmethodCall
- method call expressionpublic Object eval(String expr)
ScriptHelper
eval
in interface ScriptHelper
expr
- the expression to evaluate