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 TypeMethodDescriptionThe 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) boolean
int
hashCode()
id()
The id of the Required argumentboolean
setDefaultValue
(T value) Modifies the default value of the argumentvoid
setOptional
(boolean optional) type()
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, toString, 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 this argument
-
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
-
isOptional
public boolean isOptional()- Specified by:
isOptional
in interfaceArgument<T>
-
setOptional
public void setOptional(boolean optional) - Specified by:
setOptional
in interfaceArgument<T>
-
asOptional
-
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
- Specified by:
description
in interfaceArgument<T>
-
suggest
-
suggestions
- Specified by:
suggestions
in interfaceArgument<T>
-
suggest
-
toString
-
equals
-
hashCode
public int hashCode()
-