Class StringScriptEvaluator
java.lang.Object
org.apache.maven.plugins.scripting.StringScriptEvaluator
Evaluates a script held in a string
- Author:
- Rusi Popov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final Objectprotected Objecteval(ScriptEngine engine, ScriptContext context) AbstractScriptEvaluator the scriptprotected ScriptEnginegetEngine(ScriptEngineManager manager)
-
Constructor Details
-
StringScriptEvaluator
- Parameters:
engineName- the engine namescript- the script- Throws:
IllegalArgumentException- if either engineName or script is null
-
-
Method Details
-
getEngine
protected ScriptEngine getEngine(ScriptEngineManager manager) throws UnsupportedScriptEngineException - Parameters:
manager- the script engine manager.- Returns:
- non-null engine to execute the script
- Throws:
UnsupportedScriptEngineException- if the engineName is not supported- See Also:
-
eval
AbstractScriptEvaluator the script- Parameters:
engine- the script engine.context- the script context.- Returns:
- possibly null result of the script
- Throws:
ScriptException- if an error occurs in script.- See Also:
-
eval
protected final Object eval(Bindings bindings, org.apache.maven.plugin.logging.Log log) throws ScriptException, UnsupportedScriptEngineException - Parameters:
bindings- not null bindings to provide to the script to executelog- engine logger if context aware- Returns:
- the possibly null result the script produced
- Throws:
UnsupportedScriptEngineException- when the engine is not configured correctlyScriptException- if an error occurs in script.
-