Package org.apache.commons.cli
Class OptionGroup
java.lang.Object
org.apache.commons.cli.OptionGroup
- All Implemented Interfaces:
Serializable
A group of mutually exclusive options.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd the specifiedOption
to this group.getNames()
boolean
Tests whether this option group is required.void
setRequired
(boolean required) void
setSelected
(Option option) Sets the selected option of this group toname
.toString()
Returns the stringified version of this OptionGroup.
-
Constructor Details
-
OptionGroup
public OptionGroup()
-
-
Method Details
-
addOption
Add the specifiedOption
to this group.- Parameters:
option
- the option to add to this group- Returns:
- this option group with the option added
-
getNames
- Returns:
- the names of the options in this group as a
Collection
-
getOptions
- Returns:
- the options in this group as a
Collection
-
getSelected
- Returns:
- the selected option name
-
isRequired
Tests whether this option group is required.- Returns:
- whether this option group is required
-
setRequired
- Parameters:
required
- specifies if this group is required
-
setSelected
Sets the selected option of this group toname
.- Parameters:
option
- the option that is selected- Throws:
AlreadySelectedException
- if an option from this group has already been selected.
-
toString
Returns the stringified version of this OptionGroup.
-