iaik.tc.utils.cmdline
Class SubCommandParser

java.lang.Object
  extended by iaik.tc.utils.cmdline.CommonParser
      extended by iaik.tc.utils.cmdline.SubCommandParser

public class SubCommandParser
extends CommonParser


Constructor Summary
SubCommandParser()
           
 
Method Summary
 void addSubCmd(SubCommand subCmd)
          This method is used to add a new parameter that should be handled by the parser.
 void parse(java.lang.String[] args)
          This method parses the given argument array.
 void printUsage()
          This method prints a usage message to standard out.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubCommandParser

public SubCommandParser()
Method Detail

parse

public void parse(java.lang.String[] args)
           throws java.lang.IllegalArgumentException,
                  CommandlineException
This method parses the given argument array. It basically takes a look at the first item and checks if it is a valid sub-command. If that is the case, it obtains the parameter parser of this sub-command and passes the remaining arguments to this parser. After the parameter parser has finished (and no exception has been thrown), the application corresponding to the sub-command is started.

Throws:
java.lang.IllegalArgumentException
CommandlineException

addSubCmd

public void addSubCmd(SubCommand subCmd)
This method is used to add a new parameter that should be handled by the parser.

Parameters:
subCmd - new command line parameter

printUsage

public void printUsage()
This method prints a usage message to standard out.