org.scijava.module
Interface ModuleInfo

All Superinterfaces:
BasicDetails, Comparable<Prioritized>, Prioritized, UIDetails, Validated
All Known Subinterfaces:
MutableModuleInfo
All Known Implementing Classes:
AbstractModuleInfo, CommandInfo, DefaultMutableModuleInfo, DynamicCommandInfo, ScriptInfo

public interface ModuleInfo
extends UIDetails, Validated

A ModuleInfo object encapsulates metadata about a particular Module (but not a specific instance of it). In particular, it can report details on the names and types of inputs and outputs.

A special class of implicit input parameters is available: when the name starts with a dot (e.g. .helloWorld), no warning is issued about an unmatched input.

Author:
Aivar Grislis, Curtis Rueden

Field Summary
 
Fields inherited from interface org.scijava.UIDetails
APPLICATION_MENU_ROOT
 
Method Summary
 boolean canCancel()
          Gets whether the module condones cancellation.
 boolean canPreview()
          Gets whether the module supports previews.
 boolean canRunHeadless()
          Gets whether the module condones headless execution.
 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.
 String getInitializer()
          Gets the function that is called to initialize the module's values.
 ModuleItem<?> getInput(String name)
          Gets the input item with the given name.
<T> ModuleItem<T>
getInput(String name, Class<T> type)
          Gets the input item with the given name and type.
 ModuleItem<?> getOutput(String name)
          Gets the output item with the given name.
<T> ModuleItem<T>
getOutput(String name, Class<T> type)
          Gets the output item with the given name and type.
 Iterable<ModuleItem<?>> inputs()
          Gets the list of input items.
 boolean isInteractive()
          Gets whether the module is intended to be run interactively.
 Class<?> loadDelegateClass()
          Loads the class containing the module's actual implementation.
 Iterable<ModuleItem<?>> outputs()
          Gets the list of output items.
 void update(EventService eventService)
          Notifies interested parties that the module info has been modified.
 
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
 

Method Detail

getInput

ModuleItem<?> getInput(String name)
Gets the input item with the given name.


getInput

<T> ModuleItem<T> getInput(String name,
                           Class<T> type)
Gets the input item with the given name and type.

Throws:
IllegalArgumentException - if the given type is incompatible with the named input item

getOutput

ModuleItem<?> getOutput(String name)
Gets the output item with the given name.


getOutput

<T> ModuleItem<T> getOutput(String name,
                            Class<T> type)
Gets the output item with the given name and type.

Throws:
IllegalArgumentException - if the given type is incompatible with the named output item

inputs

Iterable<ModuleItem<?>> inputs()
Gets the list of input items.


outputs

Iterable<ModuleItem<?>> outputs()
Gets the list of output items.


getDelegateClassName

String getDelegateClassName()
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()).


loadDelegateClass

Class<?> loadDelegateClass()
                           throws ClassNotFoundException
Loads the class containing the module's actual implementation. The name of the loaded class will match the value returned by getDelegateClassName().

Throws:
ClassNotFoundException
See Also:
Instantiable.loadClass()

createModule

Module createModule()
                    throws ModuleException
Instantiates the module described by this module info.

Throws:
ModuleException

isInteractive

boolean isInteractive()
Gets whether the module is intended to be run interactively. Typically this means its inputs are supposed to be presented in a non-modal dialog box, with Runnable.run() being called whenever any of the values change.


canPreview

boolean canPreview()
Gets whether the module supports previews. A preview is a quick approximation of the results that would be obtained by actually executing the module with Runnable.run(). If this method returns false, then calling Module.preview() will have no effect.


canCancel

boolean canCancel()
Gets whether the module condones cancellation. Strictly speaking, any module execution can be canceled during preprocessing, but this flag is a hint that doing so may be a bad idea, and the UI may want to disallow it. If this method returns false, then calling Module.cancel() will have no effect.


canRunHeadless

boolean canRunHeadless()
Gets whether the module condones headless execution. Strictly speaking, there is no guarantee that any module will work headless just because it declares itself so, but this flag hints that headless execution is likely to succeed (if flag is true), or fail (if flag is false).


getInitializer

String getInitializer()
Gets the function that is called to initialize the module's values.


update

void update(EventService eventService)
Notifies interested parties that the module info has been modified. This mechanism is useful for updating any corresponding user interface such as menu items that are linked to the module.

For classes implementing this interface directly, this method should publish a ModulesUpdatedEvent to the event bus (see AbstractModuleInfo.update(EventService) for an example).



Copyright © 2009–2014 SciJava. All rights reserved.