public class StringScriptEvaluator extends Object
Constructor and Description |
---|
StringScriptEvaluator(String engineName,
String script) |
Modifier and Type | Method and Description |
---|---|
Object |
eval(Bindings bindings) |
protected Object |
eval(ScriptEngine engine,
ScriptContext context)
AbstractScriptEvaluator the script
|
protected ScriptEngine |
getEngine(ScriptEngineManager manager) |
public StringScriptEvaluator(String engineName, String script)
engineName
- the engine namescript
- the scriptIllegalArgumentException
- if either engineName or script is nullprotected ScriptEngine getEngine(ScriptEngineManager manager) throws UnsupportedScriptEngineException
manager
- the script engine manager.UnsupportedScriptEngineException
- if the engineName is not supportedAbstractScriptEvaluator.getEngine(javax.script.ScriptEngineManager)
protected Object eval(ScriptEngine engine, ScriptContext context) throws ScriptException
engine
- the script engine.context
- the script context.ScriptException
- if an error occurs in script.AbstractScriptEvaluator.eval(javax.script.ScriptEngine, javax.script.ScriptContext)
public final Object eval(Bindings bindings) throws ScriptException, UnsupportedScriptEngineException
bindings
- not null bindings to provide to the script to executeUnsupportedScriptEngineException
- when the engine is not configured correctlyScriptException
- if an error occurs in script.Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.