Class RemoveById

java.lang.Object
commandManagers.Command
commandManagers.commands.RemoveById
All Implemented Interfaces:
CommandInterface

public class RemoveById extends Command
Class RemoveById provides removal of an element from the collection by its ID number. Extends the Command class.
  • Constructor Details

    • RemoveById

      public RemoveById()
      Constructs a new command with the specified argument requirement.
  • Method Details

    • getName

      public String getName()
      Description copied from class: Command
      Base method for show command name
      Specified by:
      getName in interface CommandInterface
      Specified by:
      getName in class Command
      Returns:
      command name
    • getDescr

      public String getDescr()
      Description copied from class: Command
      Base method for show command description.
      Specified by:
      getDescr in interface CommandInterface
      Specified by:
      getDescr in class Command
      Returns:
      command description
    • execute

      public void execute()
      Overrides the method execute() in the Command class. Removes an element from the collection by its ID number. Checks the argument before execution.
      Specified by:
      execute in interface CommandInterface
      Specified by:
      execute in class Command
    • checkArgument

      public boolean checkArgument(Object inputArgument)
      Description copied from class: Command
      Checks if the given inputArgument is valid for this command.
      Specified by:
      checkArgument in interface CommandInterface
      Specified by:
      checkArgument in class Command
      Parameters:
      inputArgument - the argument to check.
      Returns:
      true if the argument is valid, false otherwise.