|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.cli.CommandLine
Represents list of arguments parsed against
a Options descriptor.
It allows querying of a boolean hasOption(String opt),
in addition to retrieving the getOptionValue(String opt)
for options requiring arguments.
Additionally, any left-over or unrecognized arguments, are available for further processing.
| Field Summary | |
private java.util.List |
args
the unrecognised options/arguments |
private java.util.Map |
hashcodeMap
Map of unique options for ease to get complete list of options |
private java.util.Map |
options
the processed options |
private Option[] |
optionsArray
the processed options |
| Constructor Summary | |
(package private) |
CommandLine()
Creates a command line. |
| Method Summary | |
(package private) void |
addArg(java.lang.String arg)
Add left-over unrecognized option/argument. |
(package private) void |
addOption(Option opt)
Add an option to the command line. |
java.util.List |
getArgList()
Retrieve any left-over non-recognized options and arguments |
java.lang.String[] |
getArgs()
Retrieve any left-over non-recognized options and arguments |
java.lang.Object |
getOptionObject(char opt)
Return the Object type of this Option. |
java.lang.Object |
getOptionObject(java.lang.String opt)
Return the Object type of this Option. |
Option[] |
getOptions()
Returns an array of the processed Options. |
java.lang.String |
getOptionValue(char opt)
Retrieve the argument, if any, of this option. |
java.lang.String |
getOptionValue(char opt,
java.lang.String defaultValue)
Retrieve the argument, if any, of an option. |
java.lang.String |
getOptionValue(java.lang.String opt)
Retrieve the argument, if any, of this option. |
java.lang.String |
getOptionValue(java.lang.String opt,
java.lang.String defaultValue)
Retrieve the argument, if any, of an option. |
java.lang.String[] |
getOptionValues(char opt)
Retrieves the array of values, if any, of an option. |
java.lang.String[] |
getOptionValues(java.lang.String opt)
Retrieves the array of values, if any, of an option. |
boolean |
hasOption(char opt)
Query to see if an option has been set. |
boolean |
hasOption(java.lang.String opt)
Query to see if an option has been set. |
java.util.Iterator |
iterator()
Returns an iterator over the Option members of CommandLine. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.util.List args
private java.util.Map options
private java.util.Map hashcodeMap
private Option[] optionsArray
| Constructor Detail |
CommandLine()
Creates a command line.
| Method Detail |
public boolean hasOption(java.lang.String opt)
Query to see if an option has been set.
opt - Short name of the option
public boolean hasOption(char opt)
Query to see if an option has been set.
opt - character name of the option
public java.lang.Object getOptionObject(java.lang.String opt)
Return the Object type of this Option.
opt - the name of the option
Optionpublic java.lang.Object getOptionObject(char opt)
Return the Object type of this Option.
opt - the name of the option
public java.lang.String getOptionValue(java.lang.String opt)
Retrieve the argument, if any, of this option.
opt - the name of the option
public java.lang.String getOptionValue(char opt)
Retrieve the argument, if any, of this option.
opt - the character name of the option
public java.lang.String[] getOptionValues(java.lang.String opt)
Retrieves the array of values, if any, of an option.
opt - string name of the option
public java.lang.String[] getOptionValues(char opt)
Retrieves the array of values, if any, of an option.
opt - character name of the option
public java.lang.String getOptionValue(java.lang.String opt,
java.lang.String defaultValue)
Retrieve the argument, if any, of an option.
opt - name of the optiondefaultValue - is the default value to be returned if the option is not specified
defaultValue.
public java.lang.String getOptionValue(char opt,
java.lang.String defaultValue)
Retrieve the argument, if any, of an option.
opt - character name of the optiondefaultValue - is the default value to be returned if the option is not specified
defaultValue.public java.lang.String[] getArgs()
Retrieve any left-over non-recognized options and arguments
public java.util.List getArgList()
Retrieve any left-over non-recognized options and arguments
List.void addArg(java.lang.String arg)
Add left-over unrecognized option/argument.
arg - the unrecognised option/argument.void addOption(Option opt)
Add an option to the command line. The values of the option are stored.
opt - the processed optionpublic java.util.Iterator iterator()
Returns an iterator over the Option members of CommandLine.
Iterator over the processed Option
members of this CommandLinepublic Option[] getOptions()
Returns an array of the processed Options.
Options.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||