public interface ScriptEvaluator
Aside from language-specific implementations, Spring also ships
a version based on the standard javax.script
package (JSR-223):
StandardScriptEvaluator
.
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.
|
@Nullable Object evaluate(ScriptSource script) throws ScriptCompilationException
script
- the ScriptSource for the script to evaluateScriptCompilationException
- if the evaluator failed to read,
compile or evaluate the script@Nullable Object evaluate(ScriptSource script, @Nullable Map<String,Object> arguments) throws ScriptCompilationException
script
- the ScriptSource for the script to evaluatearguments
- the key-value pairs to expose to the script,
typically as script variables (may be null
or empty)ScriptCompilationException
- if the evaluator failed to read,
compile or evaluate the script