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

public Class TypedArgument<T>

extends Argument
Class Inheritance
Imports
io.vertx.core.cli.converters.Converter

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.
Author
Clement Escoffier

Field Summary

Modifier and TypeField and Description
protected Converter<T>
converter

The converter to use to create the value.

protected Class<T>
type

The type of the argument.

Inherited from io.vertx.core.cli.Argument:
argNameDEFAULT_ARG_NAMEdefaultValuedescriptionhiddenindexmultiValuedrequired

Constructor Summary

AccessConstructor and Description
public
TypedArgument(TypedArgument<T>
the copied argument
arg
)

Creates a new instance of TypedArgument by copying the state of another TypedArgument.

public
TypedArgument()

Creates an empty instance of TypedArgument.

Method Summary

Modifier and TypeMethod and Description
public void
ensureValidity()

Overrides io.vertx.core.cli.Argument.ensureValidity.

Checks whether or not the argument configuration is valid.

public Converter<T>

Returns:

the converter used to create the value, null if not set
getConverter
()

public Class<T>

Returns:

the argument type, cannot be null for valid argument.
getType
()

public TypedArgument<T>
setArgName(String
the argument name, must not be null
argName
)

Overrides io.vertx.core.cli.Argument.setArgName.

Sets the argument name of this Argument.

public TypedArgument<T>

Returns:

the current TypedArgument instance
setConverter
(Converter<T>
the converter
converter
)

Sets the converter used to create the value.

public TypedArgument<T>
setDefaultValue(String
the default value
defaultValue
)

Overrides io.vertx.core.cli.Argument.setDefaultValue.

Sets the default value of this Argument.

public TypedArgument<T>
setDescription(String
the description
description
)

Overrides io.vertx.core.cli.Argument.setDescription.

Sets the description of the Argument.

public TypedArgument<T>
setHidden(boolean
enables or disables the visibility of this Argument
hidden
)

Overrides io.vertx.core.cli.Argument.setHidden.

Sets whether or not the current Argument is hidden.

public TypedArgument<T>
setIndex(int
the index, must not be negative
index
)

Overrides io.vertx.core.cli.Argument.setIndex.

Sets the argument index.

public TypedArgument<T>
setMultiValued(boolean
true to mark this argument as multi-valued.
multiValued
)

Overrides io.vertx.core.cli.Argument.setMultiValued.

Sets whether or not the argument can receive several values.

public TypedArgument<T>
setRequired(boolean
true to make this argument mandatory, false otherwise
required
)

Overrides io.vertx.core.cli.Argument.setRequired.

Sets whether or not the current Argument is required.

public TypedArgument<T>

Returns:

the current TypedArgument instance
setType
(Class<T>
the type
type
)

Sets the argument type.

Inherited from io.vertx.core.cli.Argument:
getArgNamegetDefaultValuegetDescriptiongetIndexisHiddenisMultiValuedisRequiredtoJson

Field Detail

converterback to summary
protected Converter<T> converter

The converter to use to create the value.

typeback to summary
protected Class<T> type

The type of the argument.

Constructor Detail

TypedArgumentback to summary
public TypedArgument(TypedArgument<T> arg)

Creates a new instance of TypedArgument by copying the state of another TypedArgument.

Parameters
arg:TypedArgument<T>

the copied argument

TypedArgumentback to summary
public TypedArgument()

Creates an empty instance of TypedArgument.

Method Detail

ensureValidityback to summary
public void ensureValidity()

Overrides io.vertx.core.cli.Argument.ensureValidity.

Checks whether or not the argument configuration is valid. In addition of the check made by the parent class it ensures that the type is set. If the configuration is not valid, this method throws a IllegalArgumentException.

Annotations
@Override
getConverterback to summary
public Converter<T> getConverter()
Returns:Converter<T>

the converter used to create the value, null if not set

getTypeback to summary
public Class<T> getType()
Returns:Class<T>

the argument type, cannot be null for valid argument.

setArgNameback to summary
public TypedArgument<T> setArgName(String argName)

Overrides io.vertx.core.cli.Argument.setArgName.

Doc from io.vertx.core.cli.Argument.setArgName.

Sets the argument name of this Argument.

Parameters
argName:String

the argument name, must not be null

Returns:TypedArgument<T>

the current Argument instance

Annotations
@Override
setConverterback to summary
public TypedArgument<T> setConverter(Converter<T> converter)

Sets the converter used to create the value.

Parameters
converter:Converter<T>

the converter

Returns:TypedArgument<T>

the current TypedArgument instance

setDefaultValueback to summary
public TypedArgument<T> setDefaultValue(String defaultValue)

Overrides io.vertx.core.cli.Argument.setDefaultValue.

Doc from io.vertx.core.cli.Argument.setDefaultValue.

Sets the default value of this Argument.

Parameters
defaultValue:String

the default value

Returns:TypedArgument<T>

the current Argument instance

Annotations
@Override
setDescriptionback to summary
public TypedArgument<T> setDescription(String description)

Overrides io.vertx.core.cli.Argument.setDescription.

Doc from io.vertx.core.cli.Argument.setDescription.

Sets the description of the Argument.

Parameters
description:String

the description

Returns:TypedArgument<T>

the current Argument instance

Annotations
@Override
setHiddenback to summary
public TypedArgument<T> setHidden(boolean hidden)

Overrides io.vertx.core.cli.Argument.setHidden.

Doc from io.vertx.core.cli.Argument.setHidden.

Sets whether or not the current Argument is hidden.

Parameters
hidden:boolean

enables or disables the visibility of this Argument

Returns:TypedArgument<T>

the current Argument instance

Annotations
@Override
setIndexback to summary
public TypedArgument<T> setIndex(int index)

Overrides io.vertx.core.cli.Argument.setIndex.

Doc from io.vertx.core.cli.Argument.setIndex.

Sets the argument index.

Parameters
index:int

the index, must not be negative

Returns:TypedArgument<T>

the current Argument instance

Annotations
@Override
setMultiValuedback to summary
public TypedArgument<T> setMultiValued(boolean multiValued)

Overrides io.vertx.core.cli.Argument.setMultiValued.

Doc from io.vertx.core.cli.Argument.setMultiValued.

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:TypedArgument<T>

the current Argument instance

Annotations
@Override
setRequiredback to summary
public TypedArgument<T> setRequired(boolean required)

Overrides io.vertx.core.cli.Argument.setRequired.

Doc from io.vertx.core.cli.Argument.setRequired.

Sets whether or not the current Argument is required.

Parameters
required:boolean

true to make this argument mandatory, false otherwise

Returns:TypedArgument<T>

the current Argument instance

Annotations
@Override
setTypeback to summary
public TypedArgument<T> setType(Class<T> type)

Sets the argument type.

Parameters
type:Class<T>

the type

Returns:TypedArgument<T>

the current TypedArgument instance