Class CmdEnumArg
java.lang.Object
dev.efekos.arn.resolver.impl.command.CmdEnumArg
- All Implemented Interfaces:
CommandArgumentResolver
An implementation of
CommandArgumentResolver
. Resolves custom Enum
arguments that is annotated with
CustomArgument
.- Since:
- 0.1
- Author:
- efekos
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCmdEnumArg
(Class<? extends Enum<?>> enumClass) Creates a new enumerator resolver. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.brigadier.builder.ArgumentBuilder
Creates aArgumentBuilder
that will representparameter
in the command structure.boolean
isApplicable
(Parameter parameter) Returns whether thisCommandArgumentResolver
can resolveparameter
.
-
Field Details
-
Constructor Details
-
CmdEnumArg
Creates a new enumerator resolver. This class is not a static argument resolver. It is dynamically added byArn
for everyEnum
that is annotated withCustomArgument
.- Parameters:
enumClass
- MainEnum
class this resolver will handle.
-
-
Method Details
-
isApplicable
Returns whether thisCommandArgumentResolver
can resolveparameter
. Keep in mind that there shouldn't be more than oneCommandArgumentResolver
that can resolver the same parameter.- Specified by:
isApplicable
in interfaceCommandArgumentResolver
- Parameters:
parameter
- A parameter of aCommandHandlerMethod
.- Returns:
true
if thisParameter
should be resolved using thisCommandArgumentResolver
,false
otherwise.
-
apply
Creates aArgumentBuilder
that will representparameter
in the command structure.- Specified by:
apply
in interfaceCommandArgumentResolver
- Parameters:
parameter
- A parameter of aCommandHandlerMethod
.- Returns:
- An
ArgumentBuilder
that representsparameter
.
-