Top Description Methods
org.springframework.scripting

public Interface ScriptEvaluator

Known Direct Implementers
org.springframework.scripting.bsh.BshScriptEvaluator, org.springframework.scripting.groovy.GroovyScriptEvaluator, org.springframework.scripting.support.StandardScriptEvaluator
Imports
java.util.Map, org.springframework.lang.Nullable

Spring's strategy interface for evaluating a script.

Aside from language-specific implementations, Spring also ships a version based on the standard javax.script package (JSR-223): org.springframework.scripting.support.StandardScriptEvaluator.

Authors
Juergen Hoeller, Costin Leau
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the return value of the script, if any
evaluate
(ScriptSource
the ScriptSource for the script to evaluate
script
)

Evaluate the given script.

public Object

Returns:

the return value of the script, if any
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
)

Evaluate the given script with the given arguments.

Method Detail

evaluateback to summary
public Object evaluate(ScriptSource script) throws ScriptCompilationException

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
@Nullable
Exceptions
ScriptCompilationException:
if the evaluator failed to read, compile or evaluate the script
evaluateback to summary
public Object evaluate(ScriptSource script, Map<String, Object> arguments) throws ScriptCompilationException

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
@Nullable
Exceptions
ScriptCompilationException:
if the evaluator failed to read, compile or evaluate the script