|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.commons.cli.Options
public class Options
Main entry-point into the library.
Options represents a collection of Option objects, which
describe the possible options for a command-line.
It may flexibly parse long and short options, with or without values. Additionally, it may parse only a portion of a commandline, allowing for flexible multi-stage parsing.
CommandLine| Field Summary | |
|---|---|
private java.util.Map |
longOpts
a map of the options with the long key |
private java.util.Map |
optionGroups
a map of the option groups |
private java.util.List |
requiredOpts
a map of the required options |
private java.util.Map |
shortOpts
a map of the options with the character key |
| Constructor Summary | |
|---|---|
Options()
Construct a new Options descriptor |
|
| Method Summary | |
|---|---|
Options |
addOption(Option opt)
Adds an option instance |
Options |
addOption(java.lang.String opt,
boolean hasArg,
java.lang.String description)
Add an option that only contains a short-name. |
Options |
addOption(java.lang.String opt,
java.lang.String longOpt,
boolean hasArg,
java.lang.String description)
Add an option that contains a short-name and a long-name. |
Options |
addOptionGroup(OptionGroup group)
Add the specified option group. |
Option |
getOption(java.lang.String opt)
Retrieve the named Option |
OptionGroup |
getOptionGroup(Option opt)
Returns the OptionGroup the opt
belongs to. |
(package private) java.util.Collection |
getOptionGroups()
Lists the OptionGroups that are members of this Options instance. |
java.util.Collection |
getOptions()
Retrieve a read-only list of options in this set |
java.util.List |
getRequiredOptions()
Returns the required options as a java.util.Collection. |
boolean |
hasOption(java.lang.String opt)
Returns whether the named Option is a member
of this Options. |
(package private) java.util.List |
helpOptions()
Returns the Options for use by the HelpFormatter. |
java.lang.String |
toString()
Dump state, suitable for debugging. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private java.util.Map shortOpts
private java.util.Map longOpts
private java.util.List requiredOpts
private java.util.Map optionGroups
| Constructor Detail |
|---|
public Options()
| Method Detail |
|---|
public Options addOptionGroup(OptionGroup group)
group - the OptionGroup that is to be added
java.util.Collection getOptionGroups()
public Options addOption(java.lang.String opt,
boolean hasArg,
java.lang.String description)
opt - Short single-character name of the option.hasArg - flag signally if an argument is required after this optiondescription - Self-documenting description
public Options addOption(java.lang.String opt,
java.lang.String longOpt,
boolean hasArg,
java.lang.String description)
opt - Short single-character name of the option.longOpt - Long multi-character name of the option.hasArg - flag signally if an argument is required after this optiondescription - Self-documenting description
public Options addOption(Option opt)
opt - the option that is to be added
public java.util.Collection getOptions()
Option objects in this descriptorjava.util.List helpOptions()
public java.util.List getRequiredOptions()
java.util.Collection.
public Option getOption(java.lang.String opt)
Option
opt - short or long name of the Option
public boolean hasOption(java.lang.String opt)
Option is a member
of this Options.
opt - short or long name of the Option
Option is a member
of this Optionspublic OptionGroup getOptionGroup(Option opt)
opt
belongs to.
opt - the option whose OptionGroup is being queried.
opt is part
of an OptionGroup, otherwise return nullpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||