public interface Arguments
Arguments represents the wrapped tokens that
are tokenized and parsed arguments provided to the Executor.
This class Arguments includes methods for retrieving
the value of the token provided the name for the token, number of
tokens, support for checking if the named argument exists, type of
token as specified by TokenType and helper method for
constructing JsonElement object.UsageDefinition| Modifier and Type | Method and Description |
|---|---|
int |
column()
Returns the source column number these arguments were parsed from.
|
boolean |
contains(String name)
This method checks if there exists a token named
name registered
with this object. |
int |
line()
Returns the source line number these arguments were parsed from.
|
int |
size()
Returns the number of tokens that are mapped to arguments.
|
String |
source()
This method returns the original source line of the directive as specified
the user.
|
com.google.gson.JsonElement |
toJson()
Returns
JsonElement representation of this object. |
TokenType |
type(String name)
Each token is defined as one of the types defined in the class
TokenType. |
<T extends Token> |
value(String name)
This method returns the token
value based on the name
specified in the argument. |
<T extends Token> T value(String name)
value based on the name
specified in the argument. This method will attempt to convert the token
into the expected return type T.
If the name doesn't exist in this object, then this
method is expected to return null
T - type the token need to casted to.name - of the token to be retrieved.Token.int size()
The optional arguments specified during the UsageDefinition
are not included in the size if they are not present in the tokens parsed.
boolean contains(String name)
name registered
with this object.
The name is expected to the same as specified in the UsageDefinition.
There are two reason why the name might not exists in this object :
name.name - associated with the token.name exists, false otherwise.TokenType type(String name)
TokenType.
When the directive is parsed into token, the type of the token is passed through.name - associated with the token.TokenType associated with argument name, else null.int line()
int column()
It takes the start position of the directive as the column number.
String source()
String representation of the directive.String object representing the original directive
as specified by the user.com.google.gson.JsonElement toJson()
JsonElement representation of this object.JsonElementobject representing all the
named tokens held within this object.Copyright © 2022 CDAP Licensed under the Apache License, Version 2.0.