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 Stringget()Gets this argument as a string.intgetIndex()Gets the position of this argument.static Argumentof(int index, @NotNull String argument)Creates anArgumentfrom an index and a string.default <T> Tparse(ArgumentParser<T> parser)Parses the argument using the specified parser.default @Nullable BooleanparseBoolean()Parses the argument toBoolean.default @Nullable DoubleparseDouble()Parses the argument toDouble.default @Nullable FloatparseFloat()Parses the argument toFloat.default @Nullable IntegerparseInteger()Parses the argument toInteger.default @Nullable LongparseLong()Parses the argument toLong.default @Nullable ShortparseShort()Parses the argument toShort.
-
-
-
Method Detail
-
of
static Argument of(int index, @NotNull @NotNull String argument)
Creates anArgumentfrom an index and a string.The
Argumentreturned 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
nullif it fails. - See Also:
}
-
parseShort
@Nullable default @Nullable Short parseShort()
Parses the argument toShort.- Returns:
- the result of parsing the arguments, or
nullif it fails. - See Also:
}
-
parseInteger
@Nullable default @Nullable Integer parseInteger()
Parses the argument toInteger.- Returns:
- the result of parsing the arguments, or
nullif it fails. - See Also:
}
-
parseLong
@Nullable default @Nullable Long parseLong()
Parses the argument toLong.- Returns:
- the result of parsing the arguments, or
nullif it fails. - See Also:
}
-
parseFloat
@Nullable default @Nullable Float parseFloat()
Parses the argument toFloat.- Returns:
- the result of parsing the arguments, or
nullif it fails. - See Also:
}
-
parseDouble
@Nullable default @Nullable Double parseDouble()
Parses the argument toDouble.- Returns:
- the result of parsing the arguments, or
nullif 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
nullif it fails. - See Also:
ArgumentParser.parse(Argument)
-
-