Top Description Fields Constructors Methods
io.vertx.core.cli

public Class Argument

extends Object
Class Inheritance
Known Direct Subclasses
io.vertx.core.cli.TypedArgument
Annotations
@DataObject
@JsonGen
publicConverter:false
Imports
io.vertx.codegen.annotations.DataObject, io.vertx.codegen.json.annotations.JsonGen, io.vertx.core.json.JsonObject, java.util.Objects

Defines a command line argument. Unlike options, argument don't have names and are identified using an index. The first index is 0 (because we are in the computer world).
Author
Clement Escoffier
See Also
Option

Field Summary

Modifier and TypeField and Description
protected String
argName

The argument name used in the usage.

public static final 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 Summary

AccessConstructor and Description
public
Argument()

Creates a new empty instance of Argument.

public
Argument(Argument
the argument to copy
other
)

Creates a new instance of Argument by copying other.

public
Argument(JsonObject
the json object
json
)
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Creates a new instance of Argument from the given JSON object.

Method Summary

Modifier and TypeMethod and Description
public void
ensureValidity()

Checks that the argument configuration is valid.

public String

Returns:

the arg name, null if not defined.
getArgName
()

public String

Returns:

the argument default value, null if not specified.
getDefaultValue
()

public String

Returns:

the description, null if not defined.
getDescription
()

public int

Returns:

the argument index.
getIndex
()

public boolean

Returns:

whether or not the current Argument is hidden.
isHidden
()

public boolean

Returns:

whether or not the argument can receive several values.
isMultiValued
()

public boolean

Returns:

whether or not the current Argument is required.
isRequired
()

public Argument

Returns:

the current Argument instance
setArgName
(String
the argument name, must not be null
argName
)

Sets the argument name of this Argument.

public Argument

Returns:

the current Argument instance
setDefaultValue
(String
the default value
defaultValue
)

Sets the default value of this Argument.

public Argument

Returns:

the current Argument instance
setDescription
(String
the description
description
)

Sets the description of the Argument.

public Argument

Returns:

the current Argument instance
setHidden
(boolean
enables or disables the visibility of this Argument
hidden
)

Sets whether or not the current Argument is hidden.

public Argument

Returns:

the current Argument instance
setIndex
(int
the index, must not be negative
index
)

Sets the argument index.

public Argument

Returns:

the current Argument instance
setMultiValued
(boolean
true to mark this argument as multi-valued.
multiValued
)

Sets whether or not the argument can receive several values.

public Argument

Returns:

the current Argument instance
setRequired
(boolean
true to make this argument mandatory, false otherwise
required
)

Sets whether or not the current Argument is required.

public JsonObject

Returns:

the json object representing this Argument
toJson
()
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Exports this Argument to its corresponding JSON representation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argNameback to summary
protected String argName

The argument name used in the usage.

DEFAULT_ARG_NAMEback to summary
public static final String DEFAULT_ARG_NAME

The default argument name displayed in the usage.

defaultValueback to summary
protected String defaultValue

The optional default value of this argument.

descriptionback to summary
protected String description

The argument description.

hiddenback to summary
protected boolean hidden

Whether or not this argument is hidden. Hidden argument are not shown in the usage.

indexback to summary
protected int index

The argument index. Must be positive or null. It is set fo -1 by default to check that the index was set.

multiValuedback to summary
protected boolean multiValued

Whether or not this argument can receive multiple value. Only the last argument can receive multiple values.

requiredback to summary
protected boolean required

Whether or not this argument is mandatory. Mandatory arguments throw a MissingValueException if the user command line does not provide a value.

Constructor Detail

Argumentback to summary
public Argument()

Creates a new empty instance of Argument.

Argumentback to summary
public Argument(Argument other)

Creates a new instance of Argument by copying other.

Parameters
other:Argument

the argument to copy

Argumentback to summary
public Argument(JsonObject json)

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Creates a new instance of Argument from the given JSON object.

Parameters
json:JsonObject

the json object

See Also
toJson()

Method Detail

ensureValidityback to summary
public void ensureValidity()

Checks that the argument configuration is valid. This method is mainly made for children classes adding constraint to the configuration. The parser verifies that arguments are valid before starting the parsing.

If the configuration is not valid, this method throws a IllegalArgumentException.

getArgNameback to summary
public String getArgName()
Returns:String

the arg name, null if not defined.

getDefaultValueback to summary
public String getDefaultValue()
Returns:String

the argument default value, null if not specified.

getDescriptionback to summary
public String getDescription()
Returns:String

the description, null if not defined.

getIndexback to summary
public int getIndex()
Returns:int

the argument index.

isHiddenback to summary
public boolean isHidden()
Returns:boolean

whether or not the current Argument is hidden.

isMultiValuedback to summary
public boolean isMultiValued()
Returns:boolean

whether or not the argument can receive several values.

isRequiredback to summary
public boolean isRequired()
Returns:boolean

whether or not the current Argument is required.

setArgNameback to summary
public Argument setArgName(String argName)

Sets the argument name of this Argument.

Parameters
argName:String

the argument name, must not be null

Returns:Argument

the current Argument instance

setDefaultValueback to summary
public Argument setDefaultValue(String defaultValue)

Sets the default value of this Argument.

Parameters
defaultValue:String

the default value

Returns:Argument

the current Argument instance

setDescriptionback to summary
public Argument setDescription(String description)

Sets the description of the Argument.

Parameters
description:String

the description

Returns:Argument

the current Argument instance

setHiddenback to summary
public Argument setHidden(boolean hidden)

Sets whether or not the current Argument is hidden.

Parameters
hidden:boolean

enables or disables the visibility of this Argument

Returns:Argument

the current Argument instance

setIndexback to summary
public Argument setIndex(int index)

Sets the argument index.

Parameters
index:int

the index, must not be negative

Returns:Argument

the current Argument instance

setMultiValuedback to summary
public Argument setMultiValued(boolean multiValued)

Sets whether or not the argument can receive several values. Only the last argument can receive several values.

Parameters
multiValued:boolean

true to mark this argument as multi-valued.

Returns:Argument

the current Argument instance

setRequiredback to summary
public Argument setRequired(boolean required)

Sets whether or not the current Argument is required.

Parameters
required:boolean

true to make this argument mandatory, false otherwise

Returns:Argument

the current Argument instance

toJsonback to summary
public JsonObject toJson()

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Exports this Argument to its corresponding JSON representation.

Returns:JsonObject

the json object representing this Argument

See Also
Argument(JsonObject)