Package cloud.commandframework.execution
Class CommandExecutionCoordinator<C>
- java.lang.Object
-
- cloud.commandframework.execution.CommandExecutionCoordinator<C>
-
- Type Parameters:
C
- Command sender type
- Direct Known Subclasses:
AsynchronousCommandExecutionCoordinator
,CommandExecutionCoordinator.SimpleCoordinator
public abstract class CommandExecutionCoordinator<C> extends java.lang.Object
The command execution coordinator is responsible for coordinating command execution. This includes determining what thread the command should be executed on, whether or not command may be executed in parallel, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CommandExecutionCoordinator.SimpleCoordinator<C>
A simple command execution coordinator that executes all commands immediately, on the calling thread
-
Constructor Summary
Constructors Modifier Constructor Description protected
CommandExecutionCoordinator(@NonNull CommandTree<C> commandTree)
Construct a new command execution coordinator
-
Method Summary
Modifier and Type Method Description abstract @NonNull java.util.concurrent.CompletableFuture<CommandResult<C>>
coordinateExecution(@NonNull CommandContext<C> commandContext, @NonNull java.util.Queue<@NonNull java.lang.String> input)
Coordinate the execution of a command and return the resultprotected @NonNull CommandTree<C>
getCommandTree()
Get the command treestatic <C> @NonNull java.util.function.Function<@NonNull CommandTree<C>,@NonNull CommandExecutionCoordinator<C>>
simpleCoordinator()
Returns a simple command execution coordinator that executes all commands immediately, on the calling thread
-
-
-
Constructor Detail
-
CommandExecutionCoordinator
protected CommandExecutionCoordinator(@NonNull CommandTree<C> commandTree)
Construct a new command execution coordinator- Parameters:
commandTree
- Command tree
-
-
Method Detail
-
simpleCoordinator
public static <C> @NonNull java.util.function.Function<@NonNull CommandTree<C>,@NonNull CommandExecutionCoordinator<C>> simpleCoordinator()
Returns a simple command execution coordinator that executes all commands immediately, on the calling thread- Type Parameters:
C
- Command sender type- Returns:
- New coordinator instance
-
coordinateExecution
public abstract @NonNull java.util.concurrent.CompletableFuture<CommandResult<C>> coordinateExecution(@NonNull CommandContext<C> commandContext, @NonNull java.util.Queue<@NonNull java.lang.String> input)
Coordinate the execution of a command and return the result- Parameters:
commandContext
- Command contextinput
- Command input- Returns:
- Future that completes with the result
-
getCommandTree
protected @NonNull CommandTree<C> getCommandTree()
Get the command tree- Returns:
- Command tree
-
-