public class BshScriptEvaluator extends Object implements ScriptEvaluator, BeanClassLoaderAware
ScriptEvaluator
strategy interface.Interpreter.eval(String)
Constructor and Description |
---|
BshScriptEvaluator()
Construct a new BshScriptEvaluator.
|
BshScriptEvaluator(ClassLoader classLoader)
Construct a new BshScriptEvaluator.
|
Modifier and Type | Method and Description |
---|---|
Object |
evaluate(ScriptSource script)
Evaluate the given script.
|
Object |
evaluate(ScriptSource script,
Map<String,Object> arguments)
Evaluate the given script with the given arguments.
|
void |
setBeanClassLoader(ClassLoader classLoader)
Callback that supplies the bean
class loader to
a bean instance. |
public BshScriptEvaluator()
public BshScriptEvaluator(ClassLoader classLoader)
classLoader
- the ClassLoader to use for the Interpreter
public void setBeanClassLoader(ClassLoader classLoader)
BeanClassLoaderAware
class loader
to
a bean instance.
Invoked after the population of normal bean properties but
before an initialization callback such as
InitializingBean's
InitializingBean.afterPropertiesSet()
method or a custom init-method.
setBeanClassLoader
in interface BeanClassLoaderAware
classLoader
- the owning class loader; may be null
in
which case a default ClassLoader
must be used, for example
the ClassLoader
obtained via
ClassUtils.getDefaultClassLoader()
public Object evaluate(ScriptSource script)
ScriptEvaluator
evaluate
in interface ScriptEvaluator
script
- the ScriptSource for the script to evaluatepublic Object evaluate(ScriptSource script, Map<String,Object> arguments)
ScriptEvaluator
evaluate
in interface ScriptEvaluator
script
- the ScriptSource for the script to evaluatearguments
- the key-value pairs to expose to the script,
typically as script variables. May be null
.