java.io.Serializable
public class CommandLine extends java.lang.Object implements java.io.Serializable
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.
Modifier and Type | Method | Description |
---|---|---|
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) |
Deprecated.
due to System.err message. Instead use getParsedOptionValue(String)
|
java.util.Properties |
getOptionProperties(java.lang.String opt) |
Retrieve the map of values associated to the option.
|
Option[] |
getOptions() |
Returns an array of the processed
Option s. |
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.
|
java.lang.Object |
getParsedOptionValue(java.lang.String opt) |
Return a version of this
Option converted to a particular type. |
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.
|
public boolean hasOption(java.lang.String opt)
opt
- Short name of the optionpublic boolean hasOption(char opt)
opt
- character name of the optionpublic java.lang.Object getOptionObject(java.lang.String opt)
Object
type of this Option
.opt
- the name of the optionOption
public java.lang.Object getParsedOptionValue(java.lang.String opt) throws ParseException
Option
converted to a particular type.opt
- the name of the optionParseException
- if there are problems turning the option value into the desired typePatternOptionBuilder
public java.lang.Object getOptionObject(char opt)
Object
type of this Option
.opt
- the name of the optionpublic java.lang.String getOptionValue(java.lang.String opt)
opt
- the name of the optionpublic java.lang.String getOptionValue(char opt)
opt
- the character name of the optionpublic java.lang.String[] getOptionValues(java.lang.String opt)
opt
- string name of the optionpublic java.lang.String[] getOptionValues(char opt)
opt
- character name of the optionpublic java.lang.String getOptionValue(java.lang.String opt, java.lang.String defaultValue)
opt
- name of the optiondefaultValue
- is the default value to be returned if the option
is not specifieddefaultValue
.public java.lang.String getOptionValue(char opt, java.lang.String defaultValue)
opt
- character name of the optiondefaultValue
- is the default value to be returned if the option
is not specifieddefaultValue
.public java.util.Properties getOptionProperties(java.lang.String opt)
opt
- name of the optionpublic java.lang.String[] getArgs()
public java.util.List getArgList()
List
.public java.util.Iterator iterator()
Iterator
over the processed Option
members of this CommandLine
public Option[] getOptions()
Option
s.Option
s.