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 |
isInputResolved(String name)
Gets the resolution status of the input with the given name.
|
boolean |
isOutputResolved(String name)
Gets the resolution status of the output with the given name.
|
void |
preview()
Computes a preview of the module's execution results, if available.
|
void |
resolveInput(String name)
Marks the input with the given name as resolved.
|
void |
resolveOutput(String name)
Marks the output with the given name as resolved.
|
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 |
unresolveInput(String name)
Marks the input with the given name as unresolved.
|
void |
unresolveOutput(String name)
Marks the output with the given name as unresolved.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInfo, isResolved, setResolved
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 isInputResolved(String name)
Module
isInputResolved
in interface Module
Module.resolveInput(String)
public boolean isOutputResolved(String name)
Module
isOutputResolved
in interface Module
Module.resolveOutput(String)
public void resolveInput(String name)
Module
ModulePreprocessor
s in the module execution chain that populate
input values (e.g. InputHarvester
plugins) will typically skip over
inputs which have already been resolved.
resolveInput
in interface Module
public void resolveOutput(String name)
Module
ModulePostprocessor
s in the module execution chain that handle
output values (e.g. the DisplayPostprocessor
) will typically skip
over outputs which have already been resolved.
resolveOutput
in interface Module
public void unresolveInput(String name)
Module
unresolveInput
in interface Module
Module.resolveInput(String)
public void unresolveOutput(String name)
Module
unresolveOutput
in interface Module
Module.resolveOutput(String)
Copyright © 2015–2022 SciJava. All rights reserved.