Package org.scijava.module
Interface ModuleInfo
-
- All Superinterfaces:
BasicDetails,Comparable<Prioritized>,Identifiable,Locatable,Named,Prioritized,UIDetails,Validated,Versioned
- All Known Subinterfaces:
MutableModuleInfo
- All Known Implementing Classes:
AbstractModuleInfo,CommandInfo,DefaultMutableModuleInfo,DynamicCommandInfo,ScriptInfo
public interface ModuleInfo extends UIDetails, Validated, Identifiable, Locatable, Versioned
A ModuleInfo object encapsulates metadata about a particularModule(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
namestarts 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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancanCancel()Gets whether the module condones cancellation.default booleancanPreview()Gets whether the module supports previews.default booleancanRunHeadless()Gets whether the module condones headless execution.ModulecreateModule()Instantiates the module described by this module info.StringgetDelegateClassName()Gets the fully qualified name of the class containing the module's actual implementation.default StringgetIdentifier()Gets a string intended to function as an identifier for the object.default StringgetInitializer()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.default StringgetLocation()Gets the URL string defining the object's location.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.default List<ValidityProblem>getProblems()Gets the list of problems encountered while initializing the object.default StringgetTitle()Gets an appropriate title for the object, for use in a user interface.default StringgetVersion()Gets the version of the object.Iterable<ModuleItem<?>>inputs()Gets the list of input items.default booleanisInteractive()Gets whether the module is intended to be run interactively.default booleanisValid()Gets whether the object is completely valid (i.e., no problems during initialization).Class<?>loadDelegateClass()Loads the class containing the module's actual implementation.Iterable<ModuleItem<?>>outputs()Gets the list of output items.default voidupdate(EventService eventService)Notifies interested parties that the module info has been modified.-
Methods inherited from interface org.scijava.BasicDetails
get, getDescription, getLabel, is, set, setDescription, setLabel
-
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
-
Methods inherited from interface org.scijava.UIDetails
compareTo, getIconPath, getMenuPath, getMenuRoot, getSelectionGroup, isEnabled, isSelectable, isSelected, isVisible, setEnabled, setIconPath, setMenuPath, setMenuRoot, setSelectable, setSelected, setSelectionGroup, setVisible
-
-
-
-
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 bycreateModule().getDelegateObject().getClass().getName(), and hence is also the class containing any callback methods specified byModuleItem.getCallback().The nature of this method is implementation-specific; for example, a
CommandModulewill return the class name of its associatedCommand. 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 bycreateModule().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 bygetDelegateClassName().- Throws:
ClassNotFoundException- See Also:
Instantiable.loadClass()
-
createModule
Module createModule() throws ModuleException
Instantiates the module described by this module info.- Throws:
ModuleException
-
isInteractive
default 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, withRunnable.run()being called whenever any of the values change.
-
canPreview
default 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 withRunnable.run(). If this method returns false, then callingModule.preview()will have no effect.
-
canCancel
default 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 callingModule.cancel()will have no effect.
-
canRunHeadless
default 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
default String getInitializer()
Gets the function that is called to initialize the module's values.
-
update
default 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.
-
getTitle
default String getTitle()
Description copied from interface:UIDetailsGets an appropriate title for the object, for use in a user interface. The result is prioritized as follows:- Item label
- Menu path's leaf entry name
- Item name
- Item's class name, without package prefix
-
isValid
default boolean isValid()
Description copied from interface:ValidatedGets whether the object is completely valid (i.e., no problems during initialization).
-
getProblems
default List<ValidityProblem> getProblems()
Description copied from interface:ValidatedGets the list of problems encountered while initializing the object.- Specified by:
getProblemsin interfaceValidated- Returns:
- The list of problems, or a zero-length list in the case of
Validated.isValid()returning true.
-
getIdentifier
default String getIdentifier()
Description copied from interface:IdentifiableGets a string intended to function as an identifier for the object.- Specified by:
getIdentifierin interfaceIdentifiable
-
getLocation
default String getLocation()
Description copied from interface:LocatableGets the URL string defining the object's location.- Specified by:
getLocationin interfaceLocatable
-
getVersion
default String getVersion()
Description copied from interface:VersionedGets the version of the object.- Specified by:
getVersionin interfaceVersioned
-
-