Class TypedArgument<T>
java.lang.Object
io.vertx.core.cli.Argument
io.vertx.core.cli.TypedArgument<T>
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 invalid input: '<'[email protected]>
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe converter to use to create the value.The type of the argument.Fields inherited from class Argument
argName, DEFAULT_ARG_NAME, defaultValue, description, hidden, index, multiValued, required -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty instance ofTypedArgument.TypedArgument(TypedArgument<T> arg) Creates a new instance ofTypedArgumentby copying the state of anotherTypedArgument. -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks whether or not the argument configuration is valid.getType()setArgName(String argName) Sets the argument name of thisArgument.setConverter(Converter<T> converter) Sets the converter used to create the value.setDefaultValue(String defaultValue) Sets the default value of thisArgument.setDescription(String description) Sets the description of theArgument.setHidden(boolean hidden) Sets whether or not the currentArgumentis hidden.setIndex(int index) Sets the argument index.setMultiValued(boolean multiValued) Sets whether or not the argument can receive several values.setRequired(boolean required) Sets whether or not the currentArgumentis required.Sets the argument type.Methods inherited from class Argument
getArgName, getDefaultValue, getDescription, getIndex, isHidden, isMultiValued, isRequired, toJson
-
Field Details
-
type
-
converter
-
-
Constructor Details
-
TypedArgument
Creates a new instance ofTypedArgumentby copying the state of anotherTypedArgument.- Parameters:
arg- the copied argument
-
TypedArgument
public TypedArgument()Creates an empty instance ofTypedArgument.
-
-
Method Details
-
getType
-
setType
Sets the argument type.- Parameters:
type- the type- Returns:
- the current
TypedArgumentinstance
-
getConverter
-
setConverter
Sets the converter used to create the value.- Parameters:
converter- the converter- Returns:
- the current
TypedArgumentinstance
-
ensureValidity
public void 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 aIllegalArgumentException.- Overrides:
ensureValidityin classArgument
-
setArgName
Description copied from class:ArgumentSets the argument name of thisArgument.- Overrides:
setArgNamein classArgument- Parameters:
argName- the argument name, must not benull- Returns:
- the current
Argumentinstance
-
setDefaultValue
Description copied from class:ArgumentSets the default value of thisArgument.- Overrides:
setDefaultValuein classArgument- Parameters:
defaultValue- the default value- Returns:
- the current
Argumentinstance
-
setDescription
Description copied from class:ArgumentSets the description of theArgument.- Overrides:
setDescriptionin classArgument- Parameters:
description- the description- Returns:
- the current
Argumentinstance
-
setHidden
-
setIndex
-
setRequired
Description copied from class:ArgumentSets whether or not the currentArgumentis required.- Overrides:
setRequiredin classArgument- Parameters:
required-trueto make this argument mandatory,} otherwiseinvalid @link
{@link false- Returns:
- the current
Argumentinstance
-
setMultiValued
Description copied from class:ArgumentSets whether or not the argument can receive several values. Only the last argument can receive several values.- Overrides:
setMultiValuedin classArgument- Parameters:
multiValued-trueto mark this argument as multi-valued.- Returns:
- the current
Argumentinstance
-