public class Argument extends Object
Option
Modifier and Type | Field and Description |
---|---|
protected String |
argName
The argument name used in the usage.
|
static String |
DEFAULT_ARG_NAME
The default argument name displayed in the usage.
|
protected String |
defaultValue
The optional default value of this argument.
|
protected String |
description
The argument description.
|
protected boolean |
hidden
Whether or not this argument is hidden.
|
protected int |
index
The argument index.
|
protected boolean |
multiValued
Whether or not this argument can receive multiple value.
|
protected boolean |
required
Whether or not this argument is mandatory.
|
Constructor and Description |
---|
Argument()
Creates a new empty instance of
Argument . |
Argument(Argument other)
Creates a new instance of
Argument by copying other . |
Argument(JsonObject json)
Creates a new instance of
Argument from the given JSON object. |
Modifier and Type | Method and Description |
---|---|
void |
ensureValidity()
Checks that the argument configuration is valid.
|
String |
getArgName() |
String |
getDefaultValue() |
String |
getDescription() |
int |
getIndex() |
boolean |
isHidden() |
boolean |
isMultiValued() |
boolean |
isRequired() |
Argument |
setArgName(String argName)
Sets the argument name of this
Argument . |
Argument |
setDefaultValue(String defaultValue)
Sets the default value of this
Argument . |
Argument |
setDescription(String description)
Sets the description of the
Argument . |
Argument |
setHidden(boolean hidden)
Sets whether or not the current
Argument is hidden. |
Argument |
setIndex(int index)
Sets the argument index.
|
Argument |
setMultiValued(boolean multiValued)
Sets whether or not the argument can receive several values.
|
Argument |
setRequired(boolean required)
Sets whether or not the current
Argument is required. |
JsonObject |
toJson()
Exports this
Argument to its corresponding JSON representation. |
public static final String DEFAULT_ARG_NAME
protected int index
protected String argName
protected String description
protected boolean hidden
protected boolean required
MissingValueException
if the
user command line does not provide a value.protected String defaultValue
protected boolean multiValued
public Argument()
Argument
.public Argument(Argument other)
Argument
by copying other
.other
- the argument to copypublic Argument(JsonObject json)
Argument
from the given JSON object.json
- the json objecttoJson()
public JsonObject toJson()
Argument
to its corresponding JSON representation.Argument
Argument(JsonObject)
public String getArgName()
null
if not defined.public Argument setArgName(String argName)
Argument
.argName
- the argument name, must not be null
Argument
instancepublic String getDescription()
null
if not defined.public Argument setDescription(String description)
Argument
.description
- the descriptionArgument
instancepublic boolean isHidden()
Argument
is hidden.public Argument setHidden(boolean hidden)
Argument
is hidden.public int getIndex()
public Argument setIndex(int index)
index
- the index, must not be negativeArgument
instancepublic boolean isRequired()
Argument
is required.public Argument setRequired(boolean required)
Argument
is required.required
- true
to make this argument mandatory, false
otherwiseArgument
instancepublic String getDefaultValue()
null
if not specified.public Argument setDefaultValue(String defaultValue)
Argument
.defaultValue
- the default valueArgument
instancepublic boolean isMultiValued()
public Argument setMultiValued(boolean multiValued)
multiValued
- true
to mark this argument as multi-valued.Argument
instancepublic void ensureValidity()
IllegalArgumentException
.Copyright © 2024 Eclipse. All rights reserved.