Short name is generally used with a single dash, while long name requires a double-dash.
| Modifier and Type | Field and Description |
|---|---|
| protected String | argName
the option name used in usage message. |
| protected Set | choices
if the option value has to be in a definited set, this field represents the set of values. |
| public static final String | DEFAULT_ARG_NAME
Default name in the usage message. |
| protected String | defaultValue
the option default value. |
| protected String | description
The option description. |
| protected boolean | flag
whether or not the option is a flag. |
| protected boolean | help
whether or not the option is a "help" option. |
| protected String | longName
the option long name. |
| protected boolean | multiValued
whether or not the option can recevie multiple values. |
| public static final String | NO_NAME
The default long name / short name of the option. |
| protected boolean | required
whether or not the option is required. |
| protected String | shortName
the option short name. |
| protected boolean | singleValued
whether or not the option receives a single value. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | Option(JsonObject
the json object representing the option json)
References Deprecated
JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.
Creates a new instance of |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public Option | |
| public void | |
| public String | |
| public Set | Returns: get the list of choices for the given option. Empty if this option does not define choices.
|
| public String | |
| public String | |
| public String | |
| public String | Returns: the option name. It returns the long name if set, the short name otherwise. It cannot returnnull for valid option
|
| public String | |
| public boolean | |
| public boolean | Returns: true if this option is a "help" option.Checks whether or not this option is a "Help" option. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public Option | Returns: the currentOption instancethe arg name, must not be argName)nullSets te arg name for this option. |
| public Option | Returns: the currentOptionthe choices choices)Sets the list of values accepted by this option. |
| public Option | Returns: the currentOption instancethe default value defaultValue)Sets the default value of this option |
| public Option | Returns: the currentOption instancethe description description)Sets te description of this option. |
| public Option | |
| public Option | |
| public Option | |
| public Option | Returns: the currentOption instancethe long name longName)Sets the long name of this option. |
| public Option | Returns: the currentOption instancewhether or not this option is multi-valued. multiValued)Sets whether or not this option can receive several values. |
| public Option | Returns: the currentOption instancetrue to make this option mandatory, false otherwiseSets whether or not this option is mandatory. |
| public Option | Returns: the currentOption instancethe short name shortName)Sets the short name of this option. |
| public Option | Returns: the currentOption instancewhether or not this option is single-valued. singleValued)Sets whether or not this option can receive a value. |
| public JsonObject | Returns: the json representation
References Deprecated
JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.
Gets the json representation of this |
| argName | back to summary |
|---|---|
| protected String argName the option name used in usage message. | |
| choices | back to summary |
|---|---|
| protected Set<String> choices if the option value has to be in a definited set, this field represents the set of values. Value are sorted alphabetically. | |
| DEFAULT_ARG_NAME | back to summary |
|---|---|
| public static final String DEFAULT_ARG_NAME Default name in the usage message. | |
| defaultValue | back to summary |
|---|---|
| protected String defaultValue the option default value. | |
| description | back to summary |
|---|---|
| protected String description The option description. | |
| flag | back to summary |
|---|---|
| protected boolean flag whether or not the option is a flag. Flag option does not require a value. If an option is a flag, it is
evaluated to | |
| help | back to summary |
|---|---|
| protected boolean help whether or not the option is a "help" option. Is the user execute the command line enabling a help option, the command line validation won't fail, and give the command the opportunity to display the usage message, instead of throwing an exception during the parsing. | |
| longName | back to summary |
|---|---|
| protected String longName the option long name. | |
| multiValued | back to summary |
|---|---|
| protected boolean multiValued whether or not the option can recevie multiple values. | |
| NO_NAME | back to summary |
|---|---|
| public static final String NO_NAME The default long name / short name of the option. Notice that options requires at least a regular long name or short name. | |
| required | back to summary |
|---|---|
| protected boolean required whether or not the option is required. A mandatory not set throws a | |
| shortName | back to summary |
|---|---|
| protected String shortName the option short name. | |
| singleValued | back to summary |
|---|---|
| protected boolean singleValued whether or not the option receives a single value. | |
| Option | back to summary |
|---|---|
| public Option() Creates a new empty instance of | |
| Option | back to summary |
|---|---|
| public Option(Option other) Creates a new instance of
| |
| Option | back to summary |
|---|---|
| public Option(JsonObject json)
References Deprecated
See corresponding docs for further information. Creates a new instance of
| |
| acceptValue | back to summary |
|---|---|
public boolean acceptValue()
| |
| addChoice | back to summary |
|---|---|
| public Option addChoice(String choice) Adds a choice to the list of values accepted by this option. If the value set by the user does not match once of these
values, a | |
| ensureValidity | back to summary |
|---|---|
| public void ensureValidity() Checks whether or not the option is valid. This implementation check that it has a short name or a long name.
This method is intended to be extended by sub-class. Parser should check that the set of
option of a
If the configuration is not valid, this method throws a | |
| getArgName | back to summary |
|---|---|
public String getArgName()
| |
| getChoices | back to summary |
|---|---|
| public Set | |
| getDefaultValue | back to summary |
|---|---|
public String getDefaultValue()
| |
| getDescription | back to summary |
|---|---|
public String getDescription()
| |
| getLongName | back to summary |
|---|---|
public String getLongName()
| |
| getName | back to summary |
|---|---|
public String getName()
| |
| getShortName | back to summary |
|---|---|
public String getShortName()
| |
| isFlag | back to summary |
|---|---|
public boolean isFlag()
| |
| isHelp | back to summary |
|---|---|
| public boolean isHelp() Checks whether or not this option is a "Help" option.
| |
| isHidden | back to summary |
|---|---|
public boolean isHidden()
| |
| isMultiValued | back to summary |
|---|---|
public boolean isMultiValued()
| |
| isRequired | back to summary |
|---|---|
public boolean isRequired()
| |
| isSingleValued | back to summary |
|---|---|
public boolean isSingleValued()
| |
| setArgName | back to summary |
|---|---|
| public Option setArgName(String argName) Sets te arg name for this option. | |
| setChoices | back to summary |
|---|---|
| public Option setChoices(Set<String> choices) Sets the list of values accepted by this option. If the value set by the user does not match once of these
values, a | |
| setDefaultValue | back to summary |
|---|---|
| public Option setDefaultValue(String defaultValue) Sets the default value of this option | |
| setDescription | back to summary |
|---|---|
| public Option setDescription(String description) Sets te description of this option. | |
| setFlag | back to summary |
|---|---|
| public Option setFlag(boolean flag) Configures the current | |
| setHelp | back to summary |
|---|---|
| public Option setHelp(boolean help) Sets whether or not this option is a "help" option | |
| setHidden | back to summary |
|---|---|
| public Option setHidden(boolean hidden) Sets whether or not this option should be hidden | |
| setLongName | back to summary |
|---|---|
| public Option setLongName(String longName) Sets the long name of this option. | |
| setMultiValued | back to summary |
|---|---|
| public Option setMultiValued(boolean multiValued) Sets whether or not this option can receive several values. | |
| setRequired | back to summary |
|---|---|
| public Option setRequired(boolean required) Sets whether or not this option is mandatory. | |
| setShortName | back to summary |
|---|---|
| public Option setShortName(String shortName) Sets the short name of this option. | |
| setSingleValued | back to summary |
|---|---|
| public Option setSingleValued(boolean singleValued) Sets whether or not this option can receive a value. | |
| toJson | back to summary |
|---|---|
| public JsonObject toJson()
References Deprecated
See corresponding docs for further information. Gets the json representation of this
| |