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()
Gets the scripting language of the script.
|
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)
Overrides the script language to use when executing the script.
|
void |
setOutputWriter(Writer output)
Sets the writer used to record the standard output stream.
|
cancel, getDelegateObject, getInput, getInputs, getOutput, getOutputs, initialize, isResolved, preview, setInput, setInputs, setOutput, setOutputs, setResolved
public static final String RETURN_VALUE
public ScriptModule(ScriptInfo info)
public ScriptLanguage getLanguage()
public void setLanguage(ScriptLanguage scriptLanguage)
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)
,
for an example of how to implement this interface
Copyright © 2009–2015 SciJava. All rights reserved.