Package org.incendo.cloud.suggestion
Class DelegatingSuggestionFactory<C,S extends Suggestion>
java.lang.Object
org.incendo.cloud.suggestion.DelegatingSuggestionFactory<C,S>
- Type Parameters:
C- command sender typeS- suggestion type
- All Implemented Interfaces:
SuggestionFactory<C,S>
@API(status=INTERNAL,
consumers="org.incendo.cloud.*")
public final class DelegatingSuggestionFactory<C,S extends Suggestion>
extends Object
implements SuggestionFactory<C,S>
Command suggestion engine that delegates to a
CommandTree-
Constructor Summary
ConstructorsConstructorDescriptionDelegatingSuggestionFactory(@NonNull CommandManager<C> commandManager, @NonNull CommandTree<C> commandTree, @NonNull CommandContextFactory<C> contextFactory, @NonNull ExecutionCoordinator<C> executionCoordinator, @NonNull SuggestionMapper<S> mapper) Creates a newDelegatingSuggestionFactory. -
Method Summary
Modifier and TypeMethodDescription<S2 extends Suggestion>
@NonNull SuggestionFactory<C, S2> mapped(@NonNull SuggestionMapper<S2> mapper) Returns a new suggestion factory that maps the results ofthisfactory to the typeSuggestionFactoryusing the givenmapper.Returns command suggestions for the "next" argument that would yield a correctly parsing command inputReturns command suggestions for the "next" argument that would yield a correctly parsing command inputMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.incendo.cloud.suggestion.SuggestionFactory
suggestImmediately
-
Constructor Details
-
DelegatingSuggestionFactory
public DelegatingSuggestionFactory(@NonNull CommandManager<C> commandManager, @NonNull CommandTree<C> commandTree, @NonNull CommandContextFactory<C> contextFactory, @NonNull ExecutionCoordinator<C> executionCoordinator, @NonNull SuggestionMapper<S> mapper) Creates a newDelegatingSuggestionFactory.- Parameters:
commandManager- the command managercommandTree- the command treecontextFactory- the context factoryexecutionCoordinator- the execution coordinatormapper- the suggestion mapper
-
-
Method Details
-
suggest
public @NonNull CompletableFuture<@NonNull Suggestions<C,S>> suggest(@NonNull CommandContext<C> context, @NonNull String input) Description copied from interface:SuggestionFactoryReturns command suggestions for the "next" argument that would yield a correctly parsing command input- Specified by:
suggestin interfaceSuggestionFactory<C,S extends Suggestion> - Parameters:
context- request contextinput- input provided by the sender- Returns:
- the suggestions
-
suggest
public @NonNull CompletableFuture<@NonNull Suggestions<C,S>> suggest(@NonNull C sender, @NonNull String input) Description copied from interface:SuggestionFactoryReturns command suggestions for the "next" argument that would yield a correctly parsing command input- Specified by:
suggestin interfaceSuggestionFactory<C,S extends Suggestion> - Parameters:
sender- the senderinput- input provided by the sender- Returns:
- the suggestions
-
mapped
public <S2 extends Suggestion> @NonNull SuggestionFactory<C,S2> mapped(@NonNull SuggestionMapper<S2> mapper) Description copied from interface:SuggestionFactoryReturns a new suggestion factory that maps the results ofthisfactory to the typeSuggestionFactoryusing the givenmapper.- Specified by:
mappedin interfaceSuggestionFactory<C,S extends Suggestion> - Type Parameters:
S2- the new suggestion type- Parameters:
mapper- the suggestion mapper- Returns:
- the mapped factory
-