org.hibernate.validator.util.scriptengine
Class ScriptEvaluator
java.lang.Object
org.hibernate.validator.util.scriptengine.ScriptEvaluator
public class ScriptEvaluator
- extends Object
A wrapper around JSR 223 ScriptEngine
s. This class is thread-safe.
- Author:
- Gunnar Morling, Kevin Pollet - SERLI - (kevin.pollet@serli.com)
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 © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved