Class MethodSuggestionProvider<C>
java.lang.Object
org.incendo.cloud.annotations.method.AnnotatedMethodHandler<C>
org.incendo.cloud.annotations.suggestion.MethodSuggestionProvider<C>
- Type Parameters:
C- command sender type
- All Implemented Interfaces:
SuggestionProvider<C>
public final class MethodSuggestionProvider<C>
extends AnnotatedMethodHandler<C>
implements SuggestionProvider<C>
Represents a method annotated with
Suggestions-
Constructor Summary
ConstructorsConstructorDescriptionMethodSuggestionProvider(@NonNull Object instance, @NonNull Method method, @NonNull ParameterInjectorRegistry<C> injectorRegistry) Creates a new provider. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull Iterable<@NonNull Suggestion> mapCompleted(@NonNull Object input) Maps the input to a list of suggestions.static @NonNull CompletableFuture<Iterable<@NonNull Suggestion>> mapFuture(@NonNull CompletableFuture future) Maps the future to a future of suggestions.static @NonNull CompletableFuture<Iterable<@NonNull Suggestion>> mapSuggestions(@NonNull Object input) Maps the suggestions to a future of a list of suggestions.suggestionsFuture(@NonNull CommandContext<C> context, @NonNull CommandInput input) Methods inherited from class org.incendo.cloud.annotations.method.AnnotatedMethodHandler
annotationAccessor, createParameterValues, createParameterValues, createParameterValues, getInjectedValue, getParameterValue, injectorRegistry, methodHandle, parameters
-
Constructor Details
-
MethodSuggestionProvider
public MethodSuggestionProvider(@NonNull Object instance, @NonNull Method method, @NonNull ParameterInjectorRegistry<C> injectorRegistry) Creates a new provider.- Parameters:
instance- instance that owns the methodmethod- the annotated methodinjectorRegistry- injector registry
-
-
Method Details
-
suggestionsFuture
public @NonNull CompletableFuture<Iterable<@NonNull Suggestion>> suggestionsFuture(@NonNull CommandContext<C> context, @NonNull CommandInput input) - Specified by:
suggestionsFuturein interfaceSuggestionProvider<C>
-
mapSuggestions
public static @NonNull CompletableFuture<Iterable<@NonNull Suggestion>> mapSuggestions(@NonNull Object input) Maps the suggestions to a future of a list of suggestions.- Parameters:
input- the input- Returns:
- the mapped future
-
mapFuture
public static @NonNull CompletableFuture<Iterable<@NonNull Suggestion>> mapFuture(@NonNull CompletableFuture future) Maps the future to a future of suggestions.- Parameters:
future- the future- Returns:
- the mapped future
-
mapCompleted
Maps the input to a list of suggestions. The input must be a stream, or an iterable.- Parameters:
input- the input- Returns:
- the suggestions
-