Class CommandService.Builder

    • Method Detail

      • withTransition

        public CommandService.Builder withTransition​(Class<? extends ICommand<? extends IBaseCommandData>> current,
                                                     Class<? extends ICommand<? extends IBaseCommandData>> next)
        Register a transition from current command to the next command if current command is executed without error.
        Parameters:
        current - the current command
        next - the next command to be executed if current finishes successfully
        Returns:
        the builder itself
      • withCleanUpCommand

        public CommandService.Builder withCleanUpCommand​(Class<? extends ICommand<? extends IBaseCommandData>> command)
        Register an optional clean up command that will be executed when the all the normal commands finish execution, regardless of the termination state of the last command.
        Parameters:
        command - the clean up command
        Returns:
        the builder itself.
      • withSingleCommand

        public CommandService.Builder withSingleCommand​(Class<? extends ICommand<? extends IBaseCommandData>> command)
        Register a single command that may be used by other transitions.

        This ensures the command is instantiated early in the execution flow. It may be used for the followed commands of an INextCommandAware command, where the transition is defined by the command.

        Parameters:
        command - the command to be registered.
        Returns:
        the builder itself.