org.jcommando
Class JCommandParser

java.lang.Object
  extended byorg.jcommando.JCommandParser
Direct Known Subclasses:
GeneratedParser

public class JCommandParser
extends java.lang.Object

Author:
Brett Wooldridge

Field Summary
protected  java.util.LinkedHashMap commands
           
protected  java.util.LinkedHashMap commandsById
           
protected  java.util.LinkedHashMap optionsById
           
protected  java.util.LinkedHashMap optionsByLong
           
protected  java.util.LinkedHashMap optionsByShort
           
 
Constructor Summary
JCommandParser()
           
 
Method Summary
protected  void addCommand(Command command)
           
protected  void addOption(Option option)
           
 Option getOptionById(java.lang.String id)
          Get the option with the specified id.
 void parse(java.lang.String[] args)
          This is the primary method of the parser, and is generally invoked by the user with the command-line arguments passed into their 'main'.
 void printUsage()
          Print the automatically generated usage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

optionsById

protected java.util.LinkedHashMap optionsById

optionsByShort

protected java.util.LinkedHashMap optionsByShort

optionsByLong

protected java.util.LinkedHashMap optionsByLong

commands

protected java.util.LinkedHashMap commands

commandsById

protected java.util.LinkedHashMap commandsById
Constructor Detail

JCommandParser

public JCommandParser()
Method Detail

parse

public void parse(java.lang.String[] args)
This is the primary method of the parser, and is generally invoked by the user with the command-line arguments passed into their 'main'.

Parameters:
args - command-line arguments to parse

printUsage

public void printUsage()
Print the automatically generated usage.


getOptionById

public Option getOptionById(java.lang.String id)
Get the option with the specified id.

Parameters:
id - the id of the option
Returns:
Returns the option.

addOption

protected void addOption(Option option)

addCommand

protected void addCommand(Command command)