Class AbstractCommand

    • Constructor Detail

      • AbstractCommand

        public AbstractCommand()
    • Method Detail

      • execute

        public void execute​(List<String> tokens)
                     throws Exception
        Execute a generic command, which includes parsing the options for the command and running the specific task.
        Specified by:
        execute in interface Command
        Parameters:
        tokens - - command arguments
        Throws:
        Exception
      • parseOptions

        protected void parseOptions​(List<String> tokens)
                             throws Exception
        Parse any option parameters in the command arguments specified by a '-' as the first character of the token.
        Parameters:
        tokens - - command arguments
        Throws:
        Exception
      • handleOption

        protected void handleOption​(String token,
                                    List<String> tokens)
                             throws Exception
        Handle the general options for each command, which includes -h, -?, --help, -D, --version.
        Parameters:
        token - - option token to handle
        tokens - - succeeding command arguments
        Throws:
        Exception
      • runTask

        protected abstract void runTask​(List<String> tokens)
                                 throws Exception
        Run the specific task.
        Parameters:
        tokens - - command arguments
        Throws:
        Exception
      • printHelp

        protected abstract void printHelp()
        Print the help messages for the specific task
      • printHelpFromFile

        protected void printHelpFromFile()