vertx / io.vertx.core.cli / Argument

Argument

open class Argument

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

Constructors

<init>

Argument()

Creates a new empty instance of Argument.

Argument(other: Argument)

Creates a new instance of Argument by copying other.

Argument(json: JsonObject)

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

Properties

DEFAULT_ARG_NAME

static val DEFAULT_ARG_NAME: String

The default argument name displayed in the usage.

Functions

ensureValidity

open fun ensureValidity(): Unit

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.

getArgName

open fun getArgName(): String

getDefaultValue

open fun getDefaultValue(): String

getDescription

open fun getDescription(): String

getIndex

open fun getIndex(): Int

isHidden

open fun isHidden(): Boolean

isMultiValued

open fun isMultiValued(): Boolean

isRequired

open fun isRequired(): Boolean

setArgName

open fun setArgName(argName: String): Argument

Sets the argument name of this Argument.

setDefaultValue

open fun setDefaultValue(defaultValue: String): Argument

Sets the default value of this Argument.

setDescription

open fun setDescription(description: String): Argument

Sets the description of the Argument.

setHidden

open fun setHidden(hidden: Boolean): Argument

Sets whether or not the current Argument is hidden.

setIndex

open fun setIndex(index: Int): Argument

Sets the argument index.

setMultiValued

open fun setMultiValued(multiValued: Boolean): Argument

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

setRequired

open fun setRequired(required: Boolean): Argument

Sets whether or not the current Argument is required.

toJson

open fun toJson(): JsonObject

Exports this Argument to its corresponding JSON representation.

Inheritors

TypedArgument

open class TypedArgument<T : Any> : Argument

An implementation of Argument for java specifying the type of object received by the argument. This allows converting the given raw value into the specified type.