T - the type@FunctionalInterface
public interface ArgumentProvider<T>
InputArgument into a specific type.| Modifier and Type | Method and Description |
|---|---|
default boolean |
alwaysParseQuotes()
Whether this provider wants to always parse quotes from the input.
|
default @Nullable java.lang.String |
defaultArgName(@NotNull java.lang.reflect.AnnotatedElement element)
Provides a default argument name for this provider.
|
default boolean |
handlesNullInputArguments()
Whether this provider should be called when the argument is null.
|
T |
provide(@NotNull Context ctx,
@NotNull InputArgument arg)
Converts the given
InputArgument into the specific type. |
default void |
suggest(@NotNull Context ctx,
@NotNull InputArgument arg,
@NotNull SuggestionsBuilder suggestions)
Suggests possible completions for the given
InputArgument. |
default void |
suggestRich(@NotNull Context ctx,
@NotNull InputArgument arg,
@NotNull RichSuggestionsBuilder suggestions)
Suggests possible completions for the given
InputArgument. |
default boolean handlesNullInputArguments()
This is useful for providers that want to implement logic for optional arguments,
like handling Opt.Type#SENDER.
@Nullable T provide(@NotNull @NotNull Context ctx, @NotNull @NotNull InputArgument arg) throws BladeParseError
InputArgument into the specific type.ctx - the command contextarg - the input argumentBladeParseError - if an error occurs during conversion (use BladeParseError.fatal(String) or BladeParseError.recoverable(String).)default void suggest(@NotNull
@NotNull Context ctx,
@NotNull
@NotNull InputArgument arg,
@NotNull
@NotNull SuggestionsBuilder suggestions)
throws BladeParseError
InputArgument.ctx - the command contextarg - the input argumentsuggestions - the suggestions builderBladeParseError - if an error occurs during suggestion generation (use BladeParseError.fatal(String) or BladeParseError.recoverable(String).)default void suggestRich(@NotNull
@NotNull Context ctx,
@NotNull
@NotNull InputArgument arg,
@NotNull
@NotNull RichSuggestionsBuilder suggestions)
throws BladeParseError
InputArgument.
This overload supports richer suggestion metadata, such as tooltips and numeric suggestions, for Brigadier-based platforms.
ctx - the command contextarg - the input argumentsuggestions - the rich suggestions builderBladeParseError - if an error occurs during suggestion generation (use BladeParseError.fatal(String) or BladeParseError.recoverable(String).)@Nullable
default @Nullable java.lang.String defaultArgName(@NotNull
@NotNull java.lang.reflect.AnnotatedElement element)
element - the annotated element (parameter)Namedefault boolean alwaysParseQuotes()
If true, the input argument will have quotes parsed even if the command method or
parameter is not annotated with Quoted.