Class ScriptEngineScriptEvaluator
- java.lang.Object
-
- org.hibernate.validator.spi.scripting.ScriptEngineScriptEvaluator
-
- All Implemented Interfaces:
ScriptEvaluator
@Incubating public class ScriptEngineScriptEvaluator extends Object implements ScriptEvaluator
A wrapper around JSR 223ScriptEngines. This class is thread-safe.- Since:
- 6.0.3
- Author:
- Gunnar Morling, Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI
-
-
Constructor Summary
Constructors Constructor Description ScriptEngineScriptEvaluator(ScriptEngine engine)Creates a new script executor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectevaluate(String script, Map<String,Object> bindings)Executes the given script, using the given variable bindings.
-
-
-
Constructor Detail
-
ScriptEngineScriptEvaluator
public ScriptEngineScriptEvaluator(ScriptEngine engine)
Creates a new script executor.- Parameters:
engine- the engine to be wrapped
-
-
Method Detail
-
evaluate
public Object evaluate(String script, Map<String,Object> bindings) throws ScriptEvaluationException
Executes the given script, using the given variable bindings. The execution of the script happens either synchronized or unsynchronized, depending on the engine's threading abilities.- Specified by:
evaluatein interfaceScriptEvaluator- Parameters:
script- the script to be executedbindings- the bindings to be used- Returns:
- the script's result
- Throws:
ScriptEvaluationException- in case an error occurred during the script evaluation
-
-