Interface CompositeCommand

All Superinterfaces:
Command

@OpenApiAll public interface CompositeCommand extends Command
A Command that aggregates multiple commands and executes them as a single unit.

A composite command allows grouping of multiple operations so they can be executed, undone, or canceled together.

  • Method Details

    • add

      void add(Command command)
      Adds a command to the end of this composite.
      Parameters:
      command - command to add
    • add

      void add(Command command, int index)
      Adds a command at the specified position.
      Parameters:
      command - command to add
      index - position to insert at
    • remove

      void remove(Command command)
      Removes a command from this composite.
      Parameters:
      command - command to remove
    • forEach

      void forEach(Consumer<Command> consumer)
      Applies the given action to each contained command.
      Parameters:
      consumer - action to apply
    • isEmpty

      boolean isEmpty()
      Returns whether this composite contains no commands.
      Returns:
      true if empty, otherwise false
    • insert

      void insert(Command command)
      Inserts a command according to implementation-defined ordering.
      Parameters:
      command - command to insert
    • getCommands

      List<Command> getCommands()
      Returns the list of contained commands.
      Returns:
      list of commands