Class ConfirmingCommand

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean checkExecutionState()
      Run any pre-execute command checks and return true if they all pass.
      protected boolean dontRunCommand()
      Whether to NOT run the command.
      protected abstract java.lang.String execute()
      Perform the command and return a result description.
      protected void init()
      Initializes the command.
      protected java.lang.String postExecute()
      Perform any post-execution steps (e.g.
      protected java.lang.String prompt()
      Returns the optional extra confirmation prompt for the command.
      void run()
      Performs the command.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfirmingCommand

        public ConfirmingCommand()
    • Method Detail

      • run

        public final void run()
                       throws java.lang.Exception
        Description copied from interface: Command
        Performs the command.
        Specified by:
        run in interface Command
        Throws:
        java.lang.Exception
      • checkExecutionState

        protected boolean checkExecutionState()
        Run any pre-execute command checks and return true if they all pass.
      • init

        protected void init()
                     throws java.lang.Exception
        Initializes the command.
        Throws:
        java.lang.Exception
      • dontRunCommand

        protected boolean dontRunCommand()
        Whether to NOT run the command. Override to true for dry-run commands.
      • prompt

        protected java.lang.String prompt()
                                   throws java.lang.Exception
        Returns the optional extra confirmation prompt for the command.
        Throws:
        java.lang.Exception
      • execute

        protected abstract java.lang.String execute()
                                             throws java.lang.Exception
        Perform the command and return a result description.
        Throws:
        java.lang.Exception
      • postExecute

        protected java.lang.String postExecute()
        Perform any post-execution steps (e.g. verifying the result), and return a description String to be printed if non-empty.