Package org.springframework.scripting
Interface ScriptEvaluator
- All Known Implementing Classes:
BshScriptEvaluator,GroovyScriptEvaluator,StandardScriptEvaluator
public interface ScriptEvaluator
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):
StandardScriptEvaluator.
- Since:
- 4.0
- Author:
- Juergen Hoeller, Costin Leau
-
Method Summary
Modifier and TypeMethodDescriptionevaluate(ScriptSource script) Evaluate the given script.evaluate(ScriptSource script, Map<String, Object> arguments) Evaluate the given script with the given arguments.
-
Method Details
-
evaluate
Evaluate the given script.- Parameters:
script- the ScriptSource for the script to evaluate- Returns:
- the return value of the script, if any
- Throws:
ScriptCompilationException- if the evaluator failed to read, compile or evaluate the script
-
evaluate
@Nullable Object evaluate(ScriptSource script, @Nullable Map<String, Object> arguments) throws ScriptCompilationExceptionEvaluate the given script with the given arguments.- Parameters:
script- the ScriptSource for the script to evaluatearguments- the key-value pairs to expose to the script, typically as script variables (may benullor empty)- Returns:
- the return value of the script, if any
- Throws:
ScriptCompilationException- if the evaluator failed to read, compile or evaluate the script
-