org.scijava.module
Class DefaultMutableModuleInfo

java.lang.Object
  extended by org.scijava.AbstractBasicDetails
      extended by org.scijava.AbstractUIDetails
          extended by org.scijava.module.AbstractModuleInfo
              extended by org.scijava.module.DefaultMutableModuleInfo
All Implemented Interfaces:
Comparable<Prioritized>, BasicDetails, Identifiable, ModuleInfo, MutableModuleInfo, Prioritized, UIDetails, Validated
Direct Known Subclasses:
DynamicCommandInfo

public class DefaultMutableModuleInfo
extends AbstractModuleInfo
implements MutableModuleInfo

Default MutableModuleInfo implementation.

The Module Class given in the setModuleClass(Class) method is used by getDelegateClassName() as the delegate class name, and instantiated using a no-argument constructor. As such, it is important for downstream code to call the setModuleClass(Class) method to associate the module info with its module class prior to using the module info for anything; the getDelegateClassName() and createModule() methods will fail if the module class has not been set.

Author:
Curtis Rueden

Field Summary
 
Fields inherited from interface org.scijava.UIDetails
APPLICATION_MENU_ROOT
 
Constructor Summary
DefaultMutableModuleInfo()
           
 
Method Summary
 void addInput(ModuleItem<?> input)
          Adds an input to the list.
 void addOutput(ModuleItem<?> output)
          Adds an output to the list.
 Module createModule()
          Instantiates the module described by this module info.
 String getDelegateClassName()
          Gets the fully qualified name of the class containing the module's actual implementation.
 Class<? extends Module> getModuleClass()
          Gets the module class described by this ModuleInfo.
 Class<?> loadDelegateClass()
          Loads the class containing the module's actual implementation.
 void removeInput(ModuleItem<?> input)
          Removes an input from the list.
 void removeOutput(ModuleItem<?> output)
          Removes an output from the list.
 void setModuleClass(Class<? extends Module> moduleClass)
          Sets the module class described by this ModuleInfo.
 
Methods inherited from class org.scijava.module.AbstractModuleInfo
canCancel, canPreview, canRunHeadless, clearParameters, getIdentifier, getInitializer, getInput, getInput, getOutput, getOutput, getProblems, getTitle, inputList, inputMap, inputs, isInteractive, isValid, outputList, outputMap, outputs, parseParameters, registerInput, registerOutput, update
 
Methods inherited from class org.scijava.AbstractUIDetails
compareTo, getIconPath, getMenuPath, getMenuRoot, getPriority, getSelectionGroup, isEnabled, isSelectable, isSelected, isVisible, setEnabled, setIconPath, setMenuPath, setMenuRoot, setPriority, setSelectable, setSelected, setSelectionGroup, setVisible, toString
 
Methods inherited from class org.scijava.AbstractBasicDetails
get, getDescription, getLabel, getName, is, set, setDescription, setLabel, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.module.ModuleInfo
canCancel, canPreview, canRunHeadless, getInitializer, getInput, getInput, getOutput, getOutput, inputs, isInteractive, outputs, update
 
Methods inherited from interface org.scijava.UIDetails
getIconPath, getMenuPath, getMenuRoot, getSelectionGroup, getTitle, isEnabled, isSelectable, isSelected, isVisible, setEnabled, setIconPath, setMenuPath, setMenuRoot, setSelectable, setSelected, setSelectionGroup, setVisible
 
Methods inherited from interface org.scijava.BasicDetails
get, getDescription, getLabel, getName, is, set, setDescription, setLabel, setName
 
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.scijava.Validated
getProblems, isValid
 

Constructor Detail

DefaultMutableModuleInfo

public DefaultMutableModuleInfo()
Method Detail

setModuleClass

public void setModuleClass(Class<? extends Module> moduleClass)
Description copied from interface: MutableModuleInfo
Sets the module class described by this ModuleInfo.

Specified by:
setModuleClass in interface MutableModuleInfo

getModuleClass

public Class<? extends Module> getModuleClass()
Description copied from interface: MutableModuleInfo
Gets the module class described by this ModuleInfo.

Specified by:
getModuleClass in interface MutableModuleInfo

addInput

public void addInput(ModuleItem<?> input)
Description copied from interface: MutableModuleInfo
Adds an input to the list.

Specified by:
addInput in interface MutableModuleInfo

addOutput

public void addOutput(ModuleItem<?> output)
Description copied from interface: MutableModuleInfo
Adds an output to the list.

Specified by:
addOutput in interface MutableModuleInfo

removeInput

public void removeInput(ModuleItem<?> input)
Description copied from interface: MutableModuleInfo
Removes an input from the list.

Specified by:
removeInput in interface MutableModuleInfo

removeOutput

public void removeOutput(ModuleItem<?> output)
Description copied from interface: MutableModuleInfo
Removes an output from the list.

Specified by:
removeOutput in interface MutableModuleInfo

getDelegateClassName

public String getDelegateClassName()
Description copied from interface: ModuleInfo
Gets the fully qualified name of the class containing the module's actual implementation. By definition, this is the same value returned by createModule().getDelegateObject().getClass().getName(), and hence is also the class containing any callback methods specified by ModuleItem.getCallback().

The nature of this method is implementation-specific; for example, a CommandModule will return the class name of its associated Command. For modules that are not commands, the result may be something else.

If you are implementing this interface directly, a good rule of thumb is to return the class name of the associated Module (i.e., the same value given by createModule().getClass().getName()).

Specified by:
getDelegateClassName in interface ModuleInfo

loadDelegateClass

public Class<?> loadDelegateClass()
Description copied from interface: ModuleInfo
Loads the class containing the module's actual implementation. The name of the loaded class will match the value returned by ModuleInfo.getDelegateClassName().

Specified by:
loadDelegateClass in interface ModuleInfo
See Also:
Instantiable.loadClass()

createModule

public Module createModule()
                    throws ModuleException
Description copied from interface: ModuleInfo
Instantiates the module described by this module info.

Specified by:
createModule in interface ModuleInfo
Throws:
ModuleException


Copyright © 2009–2014 SciJava. All rights reserved.