Class Save

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

public class Save extends Command
Save class represents the Save command in the program. When executed, it writes the current collection to the file.
  • Constructor Details

    • Save

      public Save()
  • 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()
      Executes the Save command. Writes the current collection to the file.
      Specified by:
      execute in interface CommandInterface
      Specified by:
      execute in class Command
    • checkArgument

      public boolean checkArgument(Object inputArgument)
      Checks whether the given argument is valid for this command. Since this command doesn't require an argument, this method always returns true.
      Specified by:
      checkArgument in interface CommandInterface
      Specified by:
      checkArgument in class Command
      Parameters:
      inputArgument - the argument to be checked
      Returns:
      true since this command doesn't require an argument