public class OptionGroup extends Object implements Serializable
| Constructor | Description |
|---|---|
OptionGroup() |
Constructs a new instance.
|
| Modifier and Type | Method | Description |
|---|---|---|
OptionGroup |
addOption(Option option) |
Adds the given
Option to this group. |
Collection<String> |
getNames() |
Gets the names of the options in this group as a
Collection. |
Collection<Option> |
getOptions() |
Gets the options in this group as a
Collection. |
String |
getSelected() |
Gets the selected option name.
|
boolean |
isRequired() |
Tests whether this option group is required.
|
boolean |
isSelected() |
Tests whether an option is selected.
|
void |
setRequired(boolean required) |
Sets whether this group is required.
|
void |
setSelected(Option option) |
Sets the selected option of this group to
name. |
String |
toString() |
Returns the stringified version of this OptionGroup.
|
public OptionGroup()
public OptionGroup addOption(Option option)
Option to this group.option - the option to add to this group.public Collection<String> getNames()
Collection.Collection.public Collection<Option> getOptions()
Collection.Collection.public String getSelected()
public boolean isRequired()
public boolean isSelected()
public void setRequired(boolean required)
required - whether this group is required.public void setSelected(Option option) throws AlreadySelectedException
name.
If the selected option is deprecated no warning is logged.option - the option that is selected.AlreadySelectedException - if an option from this group has already been selected.Copyright © 2002-2025 The Apache Software Foundation. All rights reserved.Apache Commons CLI | Issue management | Source repository