org.hibernate.validator.internal.util.scriptengine
Class ScriptEvaluator
java.lang.Object
org.hibernate.validator.internal.util.scriptengine.ScriptEvaluator
public class ScriptEvaluator
- extends Object
A wrapper around JSR 223 ScriptEngines. This class is thread-safe.
- Author:
- Gunnar Morling, Kevin Pollet (C) 2011 SERLI
|
Method Summary |
Object |
evaluate(String script,
Object obj,
String objectAlias)
Makes the given object available in then engine-scoped script context and executes the given script. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScriptEvaluator
public ScriptEvaluator(ScriptEngine engine)
- Creates a new script executor.
- Parameters:
engine - The engine to be wrapped.
evaluate
public Object evaluate(String script,
Object obj,
String objectAlias)
throws ScriptException
- Makes the given object available in then engine-scoped script context and executes the given script.
The execution of the script happens either synchronized or unsynchronized, depending on the engine's
threading abilities.
- Parameters:
script - The script to be executed.obj - The object to be put into the context.objectAlias - The name under which the given object shall be put into the context.
- Returns:
- The script's result.
- Throws:
ScriptException - In case of any errors during script execution.
Copyright © 2012 Oracle Corporation. All Rights Reserved.