public class ScriptModule extends AbstractModule implements Contextual
Module
which executes a script.Modifier and Type | Field and Description |
---|---|
static String |
RETURN_VALUE |
Constructor and Description |
---|
ScriptModule(ScriptInfo info) |
Modifier and Type | Method and Description |
---|---|
Context |
context()
Gets the application context to which the object belongs.
|
Context |
getContext()
Gets the application context to which the object belongs, or null if
Contextual.setContext(Context) has not yet been called on this object. |
ScriptEngine |
getEngine()
Gets the script engine used to execute the script.
|
ScriptInfo |
getInfo()
Gets metadata about this module.
|
ScriptLanguage |
getLanguage()
Deprecated.
Use
ScriptInfo.getLanguage() instead. |
Object |
getReturnValue()
Gets the return value of the script.
|
void |
run() |
void |
setContext(Context context)
Sets the application context to which the object belongs.
|
void |
setErrorWriter(Writer error)
Sets the writer used to record the standard error stream.
|
void |
setLanguage(ScriptLanguage scriptLanguage)
Deprecated.
Use
ScriptInfo.setLanguage(ScriptLanguage) instead. |
void |
setOutputWriter(Writer output)
Sets the writer used to record the standard output stream.
|
cancel, getDelegateObject, getInput, getInputs, getOutput, getOutputs, initialize, isInputResolved, isOutputResolved, preview, resolveInput, resolveOutput, setInput, setInputs, setOutput, setOutputs, unresolveInput, unresolveOutput
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isResolved, setResolved
public static final String RETURN_VALUE
public ScriptModule(ScriptInfo info)
public void setOutputWriter(Writer output)
public void setErrorWriter(Writer error)
public ScriptEngine getEngine()
public Object getReturnValue()
public ScriptInfo getInfo()
Module
public Context context()
Contextual
context
in interface Contextual
Contextual.getContext()
public Context getContext()
Contextual
Contextual.setContext(Context)
has not yet been called on this object.getContext
in interface Contextual
Contextual.context()
public void setContext(Context context)
Contextual
Typically this method simply delegates to Context.inject(Object)
,
and should be called only once to populate the context. Most contextual
objects do not support later alteration of the context, and will throw
IllegalStateException
if this method is invoked again.
setContext
in interface Contextual
Context.inject(Object)
@Deprecated public ScriptLanguage getLanguage()
ScriptInfo.getLanguage()
instead.@Deprecated public void setLanguage(ScriptLanguage scriptLanguage)
ScriptInfo.setLanguage(ScriptLanguage)
instead.Copyright © 2015–2022 SciJava. All rights reserved.