Class DefaultCommandService

    • Constructor Detail

      • DefaultCommandService

        public DefaultCommandService()
    • Method Detail

      • getCommandsOfClass

        public <C extends CommandList<CommandInfo> getCommandsOfClass​(Class<C> commandClass)
        Description copied from interface: CommandService
        Gets the list of commands of the given class.

        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 CommandService.getCommandsOfType(Class) on a common parent interface.

        Specified by:
        getCommandsOfClass in interface CommandService
      • getCommandsOfClass

        public List<CommandInfo> getCommandsOfClass​(String className)
        Description copied from interface: CommandService
        Gets the list of commands with the given class name.

        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 CommandService.getCommandsOfType(Class) on a common parent interface.

        Specified by:
        getCommandsOfClass in interface CommandService
      • run

        public Future<CommandModule> run​(String className,
                                         boolean process,
                                         Object... inputs)
        Description copied from interface: CommandService
        Executes the first command of the given class name.

        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.

        Specified by:
        run in interface CommandService
        Parameters:
        className - Class name of the command to execute.
        process - If true, executes the command with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins 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.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • run

        public Future<CommandModule> run​(String className,
                                         boolean process,
                                         Map<String,​Object> inputMap)
        Description copied from interface: CommandService
        Executes the first command of the given class name.

        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.

        Specified by:
        run in interface CommandService
        Parameters:
        className - Class name of the command to execute.
        process - If true, executes the command with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins 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.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • run

        public <C extends CommandFuture<CommandModule> run​(Class<C> commandClass,
                                                             boolean process,
                                                             Object... inputs)
        Description copied from interface: CommandService
        Executes the first command of the given class.

        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.

        Specified by:
        run in interface CommandService
        Type Parameters:
        C - Class of the command to execute.
        Parameters:
        commandClass - Class object of the command to execute.
        process - If true, executes the command with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins 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.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • run

        public <C extends CommandFuture<CommandModule> run​(Class<C> commandClass,
                                                             boolean process,
                                                             Map<String,​Object> inputMap)
        Description copied from interface: CommandService
        Executes the first command of the given class.

        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.

        Specified by:
        run in interface CommandService
        Type Parameters:
        C - Class of the command to execute.
        Parameters:
        commandClass - Class object of the command to execute.
        process - If true, executes the command with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins 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.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • run

        public Future<CommandModule> run​(CommandInfo info,
                                         boolean process,
                                         Object... inputs)
        Description copied from interface: CommandService
        Executes the given command.
        Specified by:
        run in interface CommandService
        Parameters:
        info - The command to instantiate and run.
        process - If true, executes the command with pre- and postprocessing steps from all available PreprocessorPlugins and PostprocessorPlugins 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.
        Returns:
        Future of the module instance being executed. Calling Future.get() will block until execution is complete.
      • initialize

        public void initialize()
        Description copied from interface: Service
        Performs any needed initialization when the service is first loaded.

        NB: This method is not intended to be called directly. It is called by the service framework itself (specifically by the ServiceHelper) when initializing the service. It should not be called a second time.

        Specified by:
        initialize in interface Initializable
        Specified by:
        initialize in interface Service