Top Description Fields Constructors Methods
org.springframework.scripting.bsh

public Class BshScriptEvaluator

extends Object
implements ScriptEvaluator, BeanClassLoaderAware
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.Aware, org.springframework.scripting.ScriptEvaluator
Imports
java.io.IOException, .StringReader, java.util.Map, bsh.EvalError, .Interpreter, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.lang.Nullable, org.springframework.scripting.ScriptCompilationException, .ScriptEvaluator, .ScriptSource

BeanShell-based implementation of Spring's ScriptEvaluator strategy interface.
Author
Juergen Hoeller
Since
4.0
See Also
Interpreter#eval(String)

Field Summary

Modifier and TypeField and Description
private ClassLoader

Constructor Summary

AccessConstructor and Description
public
BshScriptEvaluator()

Construct a new BshScriptEvaluator.

public
BshScriptEvaluator(ClassLoader
the ClassLoader to use for the Interpreter
classLoader
)

Construct a new BshScriptEvaluator.

Method Summary

Modifier and TypeMethod and Description
public Object
evaluate(ScriptSource
the ScriptSource for the script to evaluate
script
)

Implements org.springframework.scripting.ScriptEvaluator.evaluate.

Evaluate the given script.

public Object
evaluate(ScriptSource
the ScriptSource for the script to evaluate
script
,
Map<String, Object>
the key-value pairs to expose to the script, typically as script variables (may be null or empty)
arguments
)

Implements org.springframework.scripting.ScriptEvaluator.evaluate.

Evaluate the given script with the given arguments.

public void
setBeanClassLoader(ClassLoader
the owning class loader
classLoader
)

Implements org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Callback that supplies the bean class loader to a bean instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classLoaderback to summary
private ClassLoader classLoader
Annotations
@Nullable

Constructor Detail

BshScriptEvaluatorback to summary
public BshScriptEvaluator()

Construct a new BshScriptEvaluator.

BshScriptEvaluatorback to summary
public BshScriptEvaluator(ClassLoader classLoader)

Construct a new BshScriptEvaluator.

Parameters
classLoader:ClassLoader

the ClassLoader to use for the Interpreter

Method Detail

evaluateback to summary
public Object evaluate(ScriptSource script)

Implements org.springframework.scripting.ScriptEvaluator.evaluate.

Doc from org.springframework.scripting.ScriptEvaluator.evaluate.

Evaluate the given script.

Parameters
script:ScriptSource

the ScriptSource for the script to evaluate

Returns:Object

the return value of the script, if any

Annotations
@Override
@Nullable
evaluateback to summary
public Object evaluate(ScriptSource script, Map<String, Object> arguments)

Implements org.springframework.scripting.ScriptEvaluator.evaluate.

Doc from org.springframework.scripting.ScriptEvaluator.evaluate.

Evaluate the given script with the given arguments.

Parameters
script:ScriptSource

the ScriptSource for the script to evaluate

arguments:Map<String, Object>

the key-value pairs to expose to the script, typically as script variables (may be null or empty)

Returns:Object

the return value of the script, if any

Annotations
@Override
@Nullable
setBeanClassLoaderback to summary
public void setBeanClassLoader(ClassLoader classLoader)

Implements org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Doc from org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Callback that supplies the bean 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.

Parameters
classLoader:ClassLoader

the owning class loader

Annotations
@Override