Class AbstractArgument<T>
java.lang.Object
io.github.mqzn.commands.arguments.AbstractArgument<T>
- Type Parameters:
T
- the data type of the argument parameter
- All Implemented Interfaces:
Argument<T>
- Direct Known Subclasses:
ArgumentBoolean
,ArgumentEnum
,ArgumentLiteral
,ArgumentNumber
,ArgumentStringArray
,ArgumentWord
This class represents an argument as a command-syntax
parameter to be used in usages and context parsing
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractArgument
(@NotNull ArgumentData data, Class<T> type) AbstractArgument
(@NotNull String id, @NotNull Class<T> type) AbstractArgument
(@NotNull String id, @NotNull Class<T> type, boolean optional, boolean useRemainingSpace) AbstractArgument
(String id, Class<T> type, boolean useRemainingSpace) -
Method Summary
Modifier and TypeMethodDescriptionSets it automatically as optional (true)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 argumentboolean
int
hashCode()
id()
The id of the Required argumentboolean
setDefaultValue
(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-completiontoString()
changes 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 argsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.mqzn.commands.arguments.Argument
alternativeTypes, isSuggestionDynamic, parse
-
Field Details
-
suggestions
-
-
Constructor Details
-
AbstractArgument
-
AbstractArgument
-
AbstractArgument
-
AbstractArgument
-
-
Method Details
-
id
The id of the Required argument -
description
The description of an argument- Specified by:
description
in interfaceArgument<T>
- Returns:
- the description for usage
-
type
The type of the argument -
defaultValue
Description copied from interface:Argument
The default value of this argument if the default value is null, means it has no default values, so it's a REQUIRED argument !- Specified by:
defaultValue
in interfaceArgument<T>
- Returns:
- the default value of the argument if it's not set by default it's going to be null
-
setDefaultValue
Description copied from interface:Argument
Modifies the default value of the argument- Specified by:
setDefaultValue
in interfaceArgument<T>
- Parameters:
value
- the new default value- Returns:
- builder pattern
-
isOptional
public boolean isOptional()- Specified by:
isOptional
in interfaceArgument<T>
- Returns:
- whether this argument is optional or not
-
setOptional
public void setOptional(boolean optional) Sets the argument to be optional or not- Specified by:
setOptional
in interfaceArgument<T>
- Parameters:
optional
- whether it's going to be optional or not
-
asOptional
Sets it automatically as optional (true)- Returns:
- builder-pattern
-
useRemainingSpace
public boolean useRemainingSpace()Whether the argument can become greedy and use the remaining args till the end of the args- Specified by:
useRemainingSpace
in interfaceArgument<T>
- Returns:
- Whether the argument can become greedy * and use the remaining args till the end of the args
-
description
Sets the description of the argument- Specified by:
description
in interfaceArgument<T>
- Parameters:
description
- the new description of the argument- Returns:
- builder-pattern
-
suggest
Adds a suggestion object into the argument for TAB-completion -
suggestions
- Specified by:
suggestions
in interfaceArgument<T>
- Returns:
- the suggestions of this argument
-
suggest
Suggests multiple suggestions for this argument -
toString
changes the type of argument's object to a string -
toString
-
equals
-
hashCode
public int hashCode()
-