public interface ScriptHelper
Modifier and Type | Method and Description |
---|---|
Object |
call(Object obj,
String methodCall)
Call a method on the given object.
|
Object |
eval(String expr)
Evaluate the given expression.
|
Object |
eval(String expr,
Bindings bindings)
Evaluate the given expression with the given bindings.
|
Bindings |
getBindings()
Get current script bindings.
|
void |
setBindings(Bindings bindings)
Set script bindings.
|
boolean |
test(String expr)
Evaluate a boolean expression.
|
Bindings getBindings()
void setBindings(Bindings bindings)
bindings
- new script bindings.Object eval(String expr)
expr
- the expression to evaluateObject eval(String expr, Bindings bindings) throws Exception
expr
- the expression to evaluatebindings
- the context bindingsException
boolean test(String expr)
expr
- a boolean expressionObject call(Object obj, String methodCall)
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 });
obj
- the object on which method should be calledmethodCall
- method call expression