Package discord4j.command
Class ProviderContext<T>
- java.lang.Object
-
- discord4j.command.ProviderContext<T>
-
public final class ProviderContext<T> extends Object
Context from aCommandProvider
for a command's execution.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Command<T>
getCommand()
Gets the command for possible execution.Optional<T>
getContext()
Gets the context for the command's execution, if present.static <T> ProviderContext<T>
of(Command<T> command)
Constructs aProviderContext
.static <T> ProviderContext<T>
of(Command<T> command, T context)
Constructs aProviderContext
.
-
-
-
Method Detail
-
of
public static <T> ProviderContext<T> of(Command<T> command, @Nullable T context)
Constructs aProviderContext
.- Parameters:
command
- The command for possible execution.context
- The context for the command's execution. May be null.- Returns:
- A constructed
ProviderContext
.
-
of
public static <T> ProviderContext<T> of(Command<T> command)
Constructs aProviderContext
.- Parameters:
command
- The command for possible execution.- Returns:
- A constructed
ProviderContext
.
-
getCommand
public Command<T> getCommand()
Gets the command for possible execution.- Returns:
- The command for possible execution.
-
-