org.scijava.module
Class AbstractModule

java.lang.Object
  extended by org.scijava.module.AbstractModule
All Implemented Interfaces:
Runnable, Module
Direct Known Subclasses:
CommandModule, DefaultMutableModule, ModuleCommand, ScriptModule

public abstract class AbstractModule
extends Object
implements Module

Abstract superclass of Module implementations.

By default, input and output values are stored in HashMaps.

Author:
Curtis Rueden

Constructor Summary
AbstractModule()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.scijava.module.Module
getInfo
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

AbstractModule

public AbstractModule()
Method Detail

preview

public void preview()
Description copied from interface: Module
Computes a preview of the module's execution results, if available. A preview is a quick approximation of the results that would be obtained by actually executing the module with Runnable.run(). Not all modules support previews.

Specified by:
preview in interface Module
See Also:
ModuleInfo.canPreview()

cancel

public void cancel()
Description copied from interface: Module
Performs necessary cleanup in response to cancellation of the module execution. This is useful in conjunction with Module.preview() to undo any changes made as a result of the preview.

Specified by:
cancel in interface Module
See Also:
ModuleInfo.canCancel()

initialize

public void initialize()
                throws MethodCallException
Description copied from interface: Module
Initializes the module.

First, the module's global initializer method (if any) is called, followed by each individual ModuleItem initializer method (i.e., ModuleItem.initialize(Module)).

Specified by:
initialize in interface Module
Throws:
MethodCallException
See Also:
ModuleInfo.getInitializer(), ModuleItem.initialize(Module)

getDelegateObject

public Object getDelegateObject()
Description copied from interface: Module
Gets the object containing the module's actual implementation. By definition, this is an object whose fully qualified class name is given by 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.

Specified by:
getDelegateObject in interface Module

getInput

public Object getInput(String name)
Description copied from interface: Module
Gets the value of the input with the given name.

Specified by:
getInput in interface Module

getOutput

public Object getOutput(String name)
Description copied from interface: Module
Gets the value of the output with the given name.

Specified by:
getOutput in interface Module

getInputs

public Map<String,Object> getInputs()
Description copied from interface: Module
Gets a table of input values.

Specified by:
getInputs in interface Module

getOutputs

public Map<String,Object> getOutputs()
Description copied from interface: Module
Gets a table of output values.

Specified by:
getOutputs in interface Module

setInput

public void setInput(String name,
                     Object value)
Description copied from interface: Module
Sets the value of the input with the given name.

Specified by:
setInput in interface Module

setOutput

public void setOutput(String name,
                      Object value)
Description copied from interface: Module
Sets the value of the output with the given name.

Specified by:
setOutput in interface Module

setInputs

public void setInputs(Map<String,Object> inputs)
Description copied from interface: Module
Sets input values according to the given table.

Specified by:
setInputs in interface Module

setOutputs

public void setOutputs(Map<String,Object> outputs)
Description copied from interface: Module
Sets output values according to the given table.

Specified by:
setOutputs in interface Module

isResolved

public boolean isResolved(String name)
Description copied from interface: Module
Gets the resolution status of the input with the given name. A "resolved" input is known to have a final, valid value for use with the module.

Specified by:
isResolved in interface Module

setResolved

public void setResolved(String name,
                        boolean resolved)
Description copied from interface: Module
Sets the resolution status of the input with the given name. A "resolved" input is known to have a final, valid value for use with the module.

Specified by:
setResolved in interface Module


Copyright © 2009–2014 SciJava. All rights reserved.