The module service keeps a master index of all modules known to the system. At heart, a module is a Runnable piece of code, but with explicit typed input and output parameters.
The module service has no innate ability to discover modules, and must be explicitly told about them via the addModule(org.scijava.module.ModuleInfo) and addModules(java.util.Collection<? extends org.scijava.module.ModuleInfo>) methods.
A module is distinct from a plugin in that plugins extend a program's functionality in some way, taking many forms, whereas modules are always runnable code with typed inputs and outputs. There is a particular type of plugin called a Command which is also a module, but many plugins (e.g., Tools and Displays) are not modules.
| void | addModule(ModuleInfo module)
Manually registers a module with the module service.
|
| void | addModules(Collection<? extends ModuleInfo> modules)
Manually registers a list of modules with the module service.
|
| Module | createModule(ModuleInfo info)
Creates an instance of the given module.
|
| <T> T | getDefaultValue(ModuleItem<T> item)
Gets the default value of the given ModuleItem.
|
| ModuleIndex | getIndex()
Gets the index of available modules.
|
| ModuleInfo | getModuleById(String id)
Gets the module with the given identifier string.
|
| ModuleInfo | getModuleForAccelerator(Accelerator acc)
Gets the module for a given keyboard shortcut.
|
| List<ModuleInfo> | getModules()
Gets the list of available modules.
|
| <T> ModuleItem<T> | getSingleInput(Module module,
Class<T> type)
Checks the given module for a solitary unresolved fillable input of the
given type, returning the relevant ModuleItem if found, or null if
not exactly one unresolved fillable input of that type.
|
| ModuleItem<?> | getSingleInput(Module module,
Collection<Class<?>> types)
As getSingleInput(Module, Class) but will match with a set of
potential classes, at the cost of generic parameter safety.
|
| <T> ModuleItem<T> | getSingleOutput(Module module,
Class<T> type)
Checks the given module for a solitary unresolved output of the given type,
returning the relevant ModuleItem if found, or null if not exactly
one unresolved output of that type.
|
| ModuleItem<?> | getSingleOutput(Module module,
Collection<Class<?>> types)
As getSingleOutput(Module, Class) but will match with a set of
potential classes, at the cost of generic parameter safety.
|
| <T> T | load(ModuleItem<T> item)
Returns the value, if any, stored in the PrefService for the given
ModuleItem.
|
| void | loadInputs(Module module)
Loads values from persistent storage into the given Module.
|
| void | removeModule(ModuleInfo module)
Manually unregisters a module with the module service.
|
| void | removeModules(Collection<? extends ModuleInfo> modules)
Manually unregisters a list of modules with the module service.
|
| <M extends Module> Future<M> |
run(M module,
boolean process,
Map<String,Object> inputMap)
Executes the given module.
|
| <M extends Module> Future<M> |
run(M module,
boolean process,
Object... inputs)
Executes the given module.
|
| <M extends Module> Future<M> |
run(M module,
List<? extends ModulePreprocessor> pre,
List<? extends ModulePostprocessor> post,
Map<String,Object> inputMap)
Executes the given module.
|
| <M extends Module> Future<M> |
run(M module,
List<? extends ModulePreprocessor> pre,
List<? extends ModulePostprocessor> post,
Object... inputs)
Executes the given module.
|
| Future<Module> | run(ModuleInfo info,
boolean process,
Map<String,Object> inputMap)
Executes the given module.
|
| Future<Module> | run(ModuleInfo info,
boolean process,
Object... inputs)
Executes the given module.
|
| Future<Module> | run(ModuleInfo info,
List<? extends ModulePreprocessor> pre,
List<? extends ModulePostprocessor> post,
Map<String,Object> inputMap)
Executes the given module.
|
| Future<Module> | run(ModuleInfo info,
List<? extends ModulePreprocessor> pre,
List<? extends ModulePostprocessor> post,
Object... inputs)
Executes the given module.
|
| <T> void | save(ModuleItem<T> item,
T value)
Registers the given value for the given ModuleItem using the
PrefService.
|
| void | saveInputs(Module module)
Saves values to persistent storage from the given Module.
|
| <M extends Module> M |
waitFor(Future<M> future)
Blocks until the given module is finished executing.
|
If the module implements the Contextual interface, the appropriate context is injected. Similarly, if the module implements the Prioritized interface, the appropriate priority is injected.
Note that in the case of commands, this method does not do any preprocessing on the command instances, so parameters will not be auto-populated, initializers will not be executed, etc.
Copyright © 2015–2022 SciJava. All rights reserved.