public interface CommandService extends PTService<Command>, SciJavaService
A command is a particular type of plugin that is also a
Module
; i.e., it is Runnable
, with typed inputs and outputs.
The command service keeps a master index of all commands known to the system.
It asks the PluginService
for available commands, then takes care of
registering them with the ModuleService
.
SciJavaPlugin
,
ModuleService
,
PluginService
Modifier and Type | Method and Description |
---|---|
default EventService |
eventService() |
<C extends Command> |
getCommand(Class<C> commandClass)
Gets the first available command of the given class, or null if none.
|
CommandInfo |
getCommand(String className)
Gets the first available command of the given class name, or null if none.
|
List<CommandInfo> |
getCommands()
Gets the list of all available
Command s). |
<CT extends Command> |
getCommands(List<PluginInfo<CT>> plugins)
Gets the list of
Command s corresponding to the given plugins. |
<C extends Command> |
getCommandsOfClass(Class<C> commandClass)
Gets the list of commands of the given class.
|
List<CommandInfo> |
getCommandsOfClass(String className)
Gets the list of commands with the given class name.
|
<CT extends Command> |
getCommandsOfType(Class<CT> type)
Gets the list of
Command s of the given type. |
default EventService |
getEventService()
Deprecated.
Use
eventService() instead. |
default ModuleService |
getModuleService()
Deprecated.
Use
moduleService() instead. |
default ModuleService |
moduleService() |
<C extends Command> |
run(Class<C> commandClass,
boolean process,
Map<String,Object> inputMap)
Executes the first command of the given class.
|
<C extends Command> |
run(Class<C> commandClass,
boolean process,
Object... inputs)
Executes the first command of the given class.
|
Future<CommandModule> |
run(CommandInfo info,
boolean process,
Map<String,Object> inputMap)
Executes the given command.
|
Future<CommandModule> |
run(CommandInfo info,
boolean process,
Object... inputs)
Executes the given command.
|
Future<CommandModule> |
run(String className,
boolean process,
Map<String,Object> inputMap)
Executes the first command of the given class name.
|
Future<CommandModule> |
run(String className,
boolean process,
Object... inputs)
Executes the first command of the given class name.
|
create, getPlugins, getPluginService, getPluginType, pluginService
initialize, registerEventHandlers
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
dispose
default EventService eventService()
default ModuleService moduleService()
List<CommandInfo> getCommands()
Command
s).<CT extends Command> List<CommandInfo> getCommands(List<PluginInfo<CT>> plugins)
Command
s corresponding to the given plugins.<C extends Command> CommandInfo getCommand(Class<C> commandClass)
CommandInfo getCommand(String className)
<CT extends Command> List<CommandInfo> getCommandsOfType(Class<CT> type)
Command
s of the given type.<C extends Command> List<CommandInfo> getCommandsOfClass(Class<C> commandClass)
Most classes will have only a single match, but some special classes (such
as ImageJ's LegacyCommand
) may match many entries.
NB: Classes are matched by strict equality, not assignability; subtypes of
the specified class will not match. For this behavior, use
getCommandsOfType(Class)
on a common parent interface.
List<CommandInfo> getCommandsOfClass(String className)
Most classes will have only a single match, but some special classes (such
as ImageJ's LegacyCommand
) may match many entries.
NB: Classes are matched by strict equality, not assignability; subtypes of
the specified class will not match. For this behavior, use
getCommandsOfType(Class)
on a common parent interface.
Future<CommandModule> run(String className, boolean process, Object... inputs)
If no command with the given class name is registered with the service, then a default one is created and then executed. This default command is not registered with the service for subsequent usage.
className
- Class name of the command to execute.process
- If true, executes the command with pre- and postprocessing
steps from all available PreprocessorPlugin
s and
PostprocessorPlugin
s in the plugin index; if false,
executes the command with no pre- or postprocessing. For more
fine-grained control, see the ModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)
methods.inputs
- List of input parameter names and values. The expected order
is in pairs: an input name followed by its value, for each desired
input to populate. Leaving some inputs unpopulated is allowed.
Passing the name of an input that is not valid for the plugin, or
passing a value of a type incompatible with the associated input
parameter, will issue an error and ignore that name/value pair.Future
of the module instance being executed. Calling
Future.get()
will block until execution is complete.Future<CommandModule> run(String className, boolean process, Map<String,Object> inputMap)
If no command with the given class name is registered with the service, then a default one is created and then executed. This default command is not registered with the service for subsequent usage.
className
- Class name of the command to execute.process
- If true, executes the command with pre- and postprocessing
steps from all available PreprocessorPlugin
s and
PostprocessorPlugin
s in the plugin index; if false,
executes the command with no pre- or postprocessing. For more
fine-grained control, see the ModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)
methods.inputMap
- Table of input parameter values, with keys matching the
plugin's input parameter names. Passing a value of a type
incompatible with the associated input parameter will issue an
error and ignore that value.Future
of the module instance being executed. Calling
Future.get()
will block until execution is complete.<C extends Command> Future<CommandModule> run(Class<C> commandClass, boolean process, Object... inputs)
If no command of the given class is registered with the service, then a default one is created and then executed. This default command is not registered with the service for subsequent usage.
C
- Class of the command to execute.commandClass
- Class object of the command to execute.process
- If true, executes the command with pre- and postprocessing
steps from all available PreprocessorPlugin
s and
PostprocessorPlugin
s in the plugin index; if false,
executes the command with no pre- or postprocessing. For more
fine-grained control, see the ModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)
methods.inputs
- List of input parameter names and values. The expected order
is in pairs: an input name followed by its value, for each desired
input to populate. Leaving some inputs unpopulated is allowed.
Passing the name of an input that is not valid for the plugin, or
passing a value of a type incompatible with the associated input
parameter, will issue an error and ignore that name/value pair.Future
of the module instance being executed. Calling
Future.get()
will block until execution is complete.<C extends Command> Future<CommandModule> run(Class<C> commandClass, boolean process, Map<String,Object> inputMap)
If no command of the given class is registered with the service, then a default one is created and then executed. This default command is not registered with the service for subsequent usage.
C
- Class of the command to execute.commandClass
- Class object of the command to execute.process
- If true, executes the command with pre- and postprocessing
steps from all available PreprocessorPlugin
s and
PostprocessorPlugin
s in the plugin index; if false,
executes the command with no pre- or postprocessing. For more
fine-grained control, see the ModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)
methods.inputMap
- Table of input parameter values, with keys matching the
plugin's input parameter names. Passing a value of a type
incompatible with the associated input parameter will issue an
error and ignore that value.Future
of the module instance being executed. Calling
Future.get()
will block until execution is complete.Future<CommandModule> run(CommandInfo info, boolean process, Object... inputs)
info
- The command to instantiate and run.process
- If true, executes the command with pre- and postprocessing
steps from all available PreprocessorPlugin
s and
PostprocessorPlugin
s in the plugin index; if false,
executes the command with no pre- or postprocessing. For more
fine-grained control, see the ModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)
methods.inputs
- List of input parameter names and values. The expected order
is in pairs: an input name followed by its value, for each desired
input to populate. Leaving some inputs unpopulated is allowed.
Passing the name of an input that is not valid for the plugin, or
passing a value of a type incompatible with the associated input
parameter, will issue an error and ignore that name/value pair.Future
of the module instance being executed. Calling
Future.get()
will block until execution is complete.Future<CommandModule> run(CommandInfo info, boolean process, Map<String,Object> inputMap)
info
- The command to instantiate and run.process
- If true, executes the command with pre- and postprocessing
steps from all available PreprocessorPlugin
s and
PostprocessorPlugin
s in the plugin index; if false,
executes the command with no pre- or postprocessing. For more
fine-grained control, see the ModuleService.run(org.scijava.module.ModuleInfo, boolean, java.lang.Object...)
methods.inputMap
- Table of input parameter values, with keys matching the
plugin's input parameter names. Passing a value of a type
incompatible with the associated input parameter will issue an
error and ignore that value.Future
of the module instance being executed. Calling
Future.get()
will block until execution is complete.@Deprecated default EventService getEventService()
eventService()
instead.@Deprecated default ModuleService getModuleService()
moduleService()
instead.Copyright © 2015–2022 SciJava. All rights reserved.