Interface Argument<T>
- Type Parameters:
T
- the data type of the argument parameter
- All Known Implementing Classes:
AbstractArgument
,ArgumentBoolean
,ArgumentDouble
,ArgumentEnum
,ArgumentFloat
,ArgumentInteger
,ArgumentLiteral
,ArgumentLong
,ArgumentNumber
,ArgumentStringArray
,ArgumentWord
public interface Argument<T>
An interface to represent an argument as a command-syntax
parameter to be used in usages and context parsing
-
Method Summary
Modifier and TypeMethodDescriptiondefault Class<?>[]
Alternative types that relate to similar data-type of the argument example-> boolean.class refers to Boolean.classstatic ArgumentStringArray
static ArgumentBoolean
Boolean
(@NotNull ArgumentData data) static ArgumentBoolean
The default value of this argument if the default value is null, means it has no default values, so it's a REQUIRED argument !The description of an argumentdescription
(@Nullable String description) Sets the description of the argumentstatic ArgumentDouble
Double
(@NotNull ArgumentData data) static ArgumentDouble
static <E extends Enum<E>>
ArgumentEnum<E>Enum
(ArgumentData data, Class<E> enumClass) static <E extends Enum<E>>
ArgumentEnum<E>static ArgumentFloat
Float
(@NotNull ArgumentData data) static ArgumentFloat
id()
The id of the Required argumentstatic ArgumentInteger
integer
(@NotNull ArgumentData data) static ArgumentInteger
default boolean
default boolean
A dynamic suggestion is a type of suggestion in TAB-completion in which, the suggestion go through modifications and changes of its value through the app's run-time, so requires fetching/loading it actively.static ArgumentLiteral
literal
(@NotNull ArgumentData data) static ArgumentLiteral
static ArgumentLong
Long
(ArgumentData data) static ArgumentLong
<S> T
Parses the raw input into it's argument type The argument type must be registered and defined by the usersetDefaultValue
(T value) Modifies the default value of the argumentvoid
setOptional
(boolean optional) Sets the argument to be optional or notSuggests multiple suggestions for this argumentAdds a suggestion object into the argument for TAB-completionchanges the type of argument's object to a stringtype()
The type of the argumentboolean
Whether the argument can become greedy and use the remaining args till the end of the argsstatic ArgumentWord
word
(@NotNull ArgumentData data) static ArgumentWord
-
Method Details
-
literal
- Parameters:
id
- the name of the argument- Returns:
- creates a literal argument
-
word
- Parameters:
id
- the name of the argument- Returns:
- creates a word argument
-
Boolean
- Parameters:
id
- the name of the argument- Returns:
- creates a boolean(true/false) argument
-
integer
- Parameters:
id
- the name of the argument- Returns:
- creates an integer argument
-
Double
- Parameters:
id
- the name of the argument- Returns:
- creates a double argument
-
Float
- Parameters:
id
- the name of the argument- Returns:
- creates a float argument
-
Long
- Parameters:
id
- the name of the argument- Returns:
- creates a long argument
-
Array
- Parameters:
id
- the name of the argument- Returns:
- creates an array argument from a greedy/long string
-
Enum
- Parameters:
id
- the name of the argument- Returns:
- creates an enum-related argument
-
literal
- Parameters:
data
- the data of the argument- Returns:
- creates a literal argument
- See Also:
-
word
- Parameters:
data
- the data of the argument- Returns:
- creates a word/string argument
- See Also:
-
Boolean
- Parameters:
data
- the data of the argument- Returns:
- creates a boolean(true/false) argument
- See Also:
-
integer
- Parameters:
data
- the data of the argument- Returns:
- creates an integer argument
- See Also:
-
Double
- Parameters:
data
- the data of the argument- Returns:
- creates a double argument
- See Also:
-
Float
- Parameters:
data
- the data of the argument- Returns:
- creates a float argument
- See Also:
-
Long
- Parameters:
data
- the data of the argument- Returns:
- creates a long argument
- See Also:
-
Enum
- Parameters:
data
- the data of the argument- Returns:
- creates an enum argument
- See Also:
-
id
String id()The id of the Required argument- Returns:
- the id of the Required argument
-
description
The description of an argument- Returns:
- the description for usage
-
type
The type of the argument- Returns:
- the class type of the argument
-
useRemainingSpace
boolean useRemainingSpace()Whether the argument can become greedy and use the remaining args till the end of the args- Returns:
- Whether the argument can become greedy * and use the remaining args till the end of the args
-
defaultValue
The default value of this argument if the default value is null, means it has no default values, so it's a REQUIRED argument !- Returns:
- The default value of this argument
-
setDefaultValue
Modifies the default value of the argument- Parameters:
value
- the new default value
-
parse
<S> T parse(@UnknownNullability S sender, @NotNull @NotNull String command, @NotNull @NotNull String input) throws ArgumentParseException Parses the raw input into it's argument type The argument type must be registered and defined by the user- Type Parameters:
S
- the sender type- Parameters:
sender
- the sender of the commandcommand
- the commandinput
- the raw argument- Returns:
- the parsed object from raw
- Throws:
ArgumentParseException
- when it fails to parse the raw argument
-
isOptional
default boolean isOptional()- Returns:
- whether this argument is optional or not
-
setOptional
void setOptional(boolean optional) Sets the argument to be optional or not- Parameters:
optional
- whether it's gonna be optional or not
-
suggest
Adds a suggestion object into the argument for TAB-completion- Parameters:
suggestion
- the suggestion to add- Returns:
- builder-pattern
-
description
Sets the description of the argument- Parameters:
description
- the new description of the argument- Returns:
- builder-pattern
-
suggestions
- Returns:
- the suggestions of this argument
-
suggest
Suggests multiple suggestions for this argument- Parameters:
suggestions
- the suggestions to add- Returns:
- builder-pattern
-
toString
changes the type of argument's object to a string- Parameters:
obj
- the object type of the argument- Returns:
- object as string
-
alternativeTypes
Alternative types that relate to similar data-type of the argument example-> boolean.class refers to Boolean.class- Returns:
- the alternative data-types of this argument's data-types
-
isSuggestionDynamic
default boolean isSuggestionDynamic()A dynamic suggestion is a type of suggestion in TAB-completion in which, the suggestion go through modifications and changes of its value through the app's run-time, so requires fetching/loading it actively.- Returns:
- whether this argument is based on dynamic suggestions or not
-