Interface Argument
-
public interface Argument
Represents a command argument.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @NotNull String
get()
Gets this argument as a string.int
getIndex()
Gets the position of this argument.static Argument
of(int index, @NotNull String argument)
Creates anArgument
from an index and a string.default <T> T
parse(ArgumentParser<T> parser)
Parses the argument using the specified parser.default @Nullable Boolean
parseBoolean()
Parses the argument toBoolean
.default @Nullable Double
parseDouble()
Parses the argument toDouble
.default @Nullable Float
parseFloat()
Parses the argument toFloat
.default @Nullable Integer
parseInteger()
Parses the argument toInteger
.default @Nullable Long
parseLong()
Parses the argument toLong
.default @Nullable Short
parseShort()
Parses the argument toShort
.
-
-
-
Method Detail
-
of
static Argument of(int index, @NotNull @NotNull String argument)
Creates anArgument
from an index and a string.The
Argument
returned by this method implementsObject.hashCode()
,Object.equals(Object)
, andObject.toString()
.- Parameters:
index
- the position of this argumentargument
- the argument- Returns:
Argument
-
getIndex
int getIndex()
Gets the position of this argument.- Returns:
- the position of this argument
-
get
@NotNull @NotNull String get()
Gets this argument as a string.- Returns:
- this argument as a string
-
parseBoolean
@Nullable default @Nullable Boolean parseBoolean()
Parses the argument toBoolean
.- Returns:
- the result of parsing the arguments, or
null
if it fails. - See Also:
}
-
parseShort
@Nullable default @Nullable Short parseShort()
Parses the argument toShort
.- Returns:
- the result of parsing the arguments, or
null
if it fails. - See Also:
}
-
parseInteger
@Nullable default @Nullable Integer parseInteger()
Parses the argument toInteger
.- Returns:
- the result of parsing the arguments, or
null
if it fails. - See Also:
}
-
parseLong
@Nullable default @Nullable Long parseLong()
Parses the argument toLong
.- Returns:
- the result of parsing the arguments, or
null
if it fails. - See Also:
}
-
parseFloat
@Nullable default @Nullable Float parseFloat()
Parses the argument toFloat
.- Returns:
- the result of parsing the arguments, or
null
if it fails. - See Also:
}
-
parseDouble
@Nullable default @Nullable Double parseDouble()
Parses the argument toDouble
.- Returns:
- the result of parsing the arguments, or
null
if it fails. - See Also:
}
-
parse
default <T> T parse(ArgumentParser<T> parser)
Parses the argument using the specified parser.- Type Parameters:
T
- the value type- Parameters:
parser
- the parser- Returns:
- the result of parsing the arguments, or
null
if it fails. - See Also:
ArgumentParser.parse(Argument)
-
-