Annotation Type Parser
This annotation allows you to create annotated methods that behave like argument parsers.
The method parameters can be any combination of:
CommandContextCommandInput- the command sender type
- any type that can be injected using
CommandContext.inject(Class)
The method can throw exceptions, and the thrown exceptions will automatically be
wrapped by a ArgumentParseResult.failure(Throwable).
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionReturns name of the parser.Returns the of the suggestion provider to use.
-
Element Details
-
name
String nameReturns name of the parser.If this is left empty, the parser will be registered as a default parser for the return type of the method.
- Returns:
- Parser name
- Default:
""
-
suggestions
String suggestionsReturns the of the suggestion provider to use.If the string is left empty, the default provider for the
Argumentwill be used. Otherwise, theParserRegistryinstance in theCommandManagerwill be queried for a matching suggestion provider.For this to work, the suggestion needs to be registered in the parser registry. To do this, use
ParserRegistry.registerSuggestionProvider(String, SuggestionProvider). The registry instance can be retrieved usingCommandManager.parserRegistry().- Returns:
- The name of the suggestion provider, or
""
- Default:
""
-