Package com.axelor.script
Class AbstractScriptHelper
- java.lang.Object
-
- com.axelor.script.AbstractScriptHelper
-
- All Implemented Interfaces:
ScriptHelper
- Direct Known Subclasses:
CompositeScriptHelper,ELScriptHelper,GroovyScriptHelper,JavaScriptScriptHelper
public abstract class AbstractScriptHelper extends Object implements ScriptHelper
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description AbstractScriptHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectcall(Object obj, String methodCall)Call a method on the given object.protected ObjectdoCall(Object obj, String methodCall)Objecteval(String expr)Evaluate the given expression.BindingsgetBindings()Get current script bindings.voidsetBindings(Bindings bindings)Set script bindings.booleantest(String expr)Evaluate a boolean expression.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.axelor.script.ScriptHelper
eval
-
-
-
-
Method Detail
-
getBindings
public Bindings getBindings()
Description copied from interface:ScriptHelperGet current script bindings.- Specified by:
getBindingsin interfaceScriptHelper- Returns:
- bindings
-
setBindings
public void setBindings(Bindings bindings)
Description copied from interface:ScriptHelperSet script bindings.- Specified by:
setBindingsin interfaceScriptHelper- Parameters:
bindings- new script bindings.
-
test
public final boolean test(String expr)
Description copied from interface:ScriptHelperEvaluate a boolean expression.- Specified by:
testin interfaceScriptHelper- Parameters:
expr- a boolean expression- Returns:
- true or false
-
call
public Object call(Object obj, String methodCall)
Description copied from interface:ScriptHelperCall a method on the given object.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 });- Specified by:
callin interfaceScriptHelper- Parameters:
obj- the object on which method should be calledmethodCall- method call expression- Returns:
- return value of the method
-
eval
public Object eval(String expr)
Description copied from interface:ScriptHelperEvaluate the given expression.- Specified by:
evalin interfaceScriptHelper- Parameters:
expr- the expression to evaluate- Returns:
- expression result
-
-