public abstract class AbstractModule extends Object implements Module
Module
implementations.
By default, input and output values are stored in HashMap
s.
Constructor and Description |
---|
AbstractModule() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Performs necessary cleanup in response to cancellation of the module
execution.
|
Object |
getDelegateObject()
Gets the object containing the module's actual implementation.
|
Object |
getInput(String name)
Gets the value of the input with the given name.
|
Map<String,Object> |
getInputs()
Gets a table of input values.
|
Object |
getOutput(String name)
Gets the value of the output with the given name.
|
Map<String,Object> |
getOutputs()
Gets a table of output values.
|
void |
initialize()
Initializes the module.
|
boolean |
isResolved(String name)
Gets the resolution status of the input with the given name.
|
void |
preview()
Computes a preview of the module's execution results, if available.
|
void |
setInput(String name,
Object value)
Sets the value of the input with the given name.
|
void |
setInputs(Map<String,Object> inputs)
Sets input values according to the given table.
|
void |
setOutput(String name,
Object value)
Sets the value of the output with the given name.
|
void |
setOutputs(Map<String,Object> outputs)
Sets output values according to the given table.
|
void |
setResolved(String name,
boolean resolved)
Sets the resolution status of the input with the given name.
|
public void preview()
Module
Runnable.run()
. Not all modules support
previews.preview
in interface Module
ModuleInfo.canPreview()
public void cancel()
Module
Module.preview()
to undo
any changes made as a result of the preview.cancel
in interface Module
ModuleInfo.canCancel()
public void initialize() throws MethodCallException
Module
First, the module's global initializer method (if any) is called, followed
by each individual ModuleItem
initializer method (i.e.,
ModuleItem.initialize(Module)
).
initialize
in interface Module
MethodCallException
ModuleInfo.getInitializer()
,
ModuleItem.initialize(Module)
public Object getDelegateObject()
Module
getInfo().getDelegateClassName()
. This object must possess all
callback methods specified by ModuleItem.getCallback()
.
The nature of this method is implementation-specific; e.g., a
CommandModule
will return its associated Command
. For
modules that are not plugins, the result may be something else. If you are
implementing this interface directly, a good rule of thumb is to return
this
.
getDelegateObject
in interface Module
public Object getInput(String name)
Module
public Object getOutput(String name)
Module
public Map<String,Object> getInputs()
Module
public Map<String,Object> getOutputs()
Module
getOutputs
in interface Module
public void setInput(String name, Object value)
Module
public void setOutput(String name, Object value)
Module
public void setInputs(Map<String,Object> inputs)
Module
public void setOutputs(Map<String,Object> outputs)
Module
setOutputs
in interface Module
public boolean isResolved(String name)
Module
isResolved
in interface Module
public void setResolved(String name, boolean resolved)
Module
setResolved
in interface Module
Copyright © 2009–2015 SciJava. All rights reserved.