public class ScriptEnginePluginAcceptor extends Object implements PluginAcceptor
PluginAcceptor
implementation for bare ScriptEngine
implementations allowing plugins to
interact with them on initialization.Constructor and Description |
---|
ScriptEnginePluginAcceptor(ScriptEngine scriptEngine) |
Modifier and Type | Method and Description |
---|---|
void |
addBinding(String key,
Object val)
Adds global bindings to the
ScriptEngine that will be applied to every evaluated script. |
void |
addImports(Set<String> importStatements)
If the
ScriptEngine implements the DependencyManager interface it will try to import the
specified import statements. |
Map<String,Object> |
environment()
Defines the environment settings for the
GremlinPlugin . |
Object |
eval(String script)
Evaluate a script in the
ScriptEngine . |
Map<String,Object> |
getBindings()
Gets the global bindings that will be applied to every evaluated script.
|
public ScriptEnginePluginAcceptor(ScriptEngine scriptEngine)
public void addBinding(String key, Object val)
ScriptEngine
that will be applied to every evaluated script.addBinding
in interface PluginAcceptor
public Map<String,Object> getBindings()
getBindings
in interface PluginAcceptor
public void addImports(Set<String> importStatements)
ScriptEngine
implements the DependencyManager
interface it will try to import the
specified import statements.addImports
in interface PluginAcceptor
public Object eval(String script) throws ScriptException
ScriptEngine
. Typically eval()
should be called after imports as
ScriptEngine
resets may occur during import.eval
in interface PluginAcceptor
ScriptException
public Map<String,Object> environment()
GremlinPlugin
.environment
in interface PluginAcceptor
Copyright © 2013–2016 Apache Software Foundation. All rights reserved.