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 223 ScriptEngines. This class is thread-safe.
Since:
6.0.3
Author:
Gunnar Morling, Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI
  • Constructor Details

    • ScriptEngineScriptEvaluator

      public ScriptEngineScriptEvaluator(ScriptEngine engine)
      Creates a new script executor.
      Parameters:
      engine - the engine to be wrapped
  • Method Details

    • 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:
      evaluate in interface ScriptEvaluator
      Parameters:
      script - the script to be executed
      bindings - the bindings to be used
      Returns:
      the script's result
      Throws:
      ScriptEvaluationException - in case an error occurred during the script evaluation