public class CommandLineParser
extends java.lang.Object
Constructor and Description |
---|
CommandLineParser(java.lang.String[] commandLine,
java.lang.String[] switches,
java.lang.String[] options)
Given a command line, valid switches and valid options,
initialize this parser.
|
Modifier and Type | Method and Description |
---|---|
int |
getOptionCount() |
java.lang.String |
getOptionValue(java.lang.String optionStr)
Given the option setting, return its value.
|
int |
getSwitchCount() |
boolean |
isOptionDefined(java.lang.String optionStr)
Returns whether this option was used on the command line.
|
boolean |
isSwitchDefined(java.lang.String switchStr)
Returns whether this switch was used on the command line.
|
boolean |
parseCommandLine()
Parses the command line, and returns whether the parse was
successful.
|
public CommandLineParser(java.lang.String[] commandLine, java.lang.String[] switches, java.lang.String[] options)
commandLine
- Command line to parseswitches
- valid switchesoptions
- valid optionspublic boolean parseCommandLine()
public java.lang.String getOptionValue(java.lang.String optionStr)
optionStr
- Name of optionpublic boolean isSwitchDefined(java.lang.String switchStr)
switchStr
- Name of switchpublic boolean isOptionDefined(java.lang.String optionStr)
optionStr
- Name of optionpublic int getSwitchCount()
public int getOptionCount()