public class CommandContexts<R extends CommandExecutionContext<?,? extends CommandIssuer>> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Map<Class<?>,ContextResolver<?,R>> |
contextMap |
protected CommandManager |
manager |
| Modifier and Type | Method and Description |
|---|---|
ContextResolver<?,R> |
getResolver(Class<?> type) |
<T> void |
registerContext(Class<T> context,
ContextResolver<T,R> supplier)
Registers a context that requires input from the command issuer to resolve.
|
<T> void |
registerIssuerAwareContext(Class<T> context,
IssuerAwareContextResolver<T,R> supplier)
Registers a context resolver that may conditionally consume input, falling back to using the context of the
issuer to potentially fulfill this context.
|
<T> void |
registerIssuerOnlyContext(Class<T> context,
IssuerOnlyContextResolver<T,R> supplier)
Registers a context resolver that will never consume input.
|
<T> void |
registerOptionalContext(Class<T> context,
OptionalContextResolver<T,R> supplier)
Registers a context that can safely accept a null input from the command issuer to resolve.
|
<T> void |
registerSenderAwareContext(Class<T> context,
IssuerAwareContextResolver<T,R> supplier)
Deprecated.
Please switch to
registerIssuerAwareContext(Class, IssuerAwareContextResolver)
as the core wants to use the platform agnostic term of "Issuer" instead of Sender |
protected final Map<Class<?>,ContextResolver<?,R extends CommandExecutionContext<?,? extends CommandIssuer>>> contextMap
protected final CommandManager manager
@Deprecated public <T> void registerSenderAwareContext(Class<T> context, IssuerAwareContextResolver<T,R> supplier)
registerIssuerAwareContext(Class, IssuerAwareContextResolver)
as the core wants to use the platform agnostic term of "Issuer" instead of Senderpublic <T> void registerIssuerAwareContext(Class<T> context, IssuerAwareContextResolver<T,R> supplier)
CommandExecutionContext.getFirstArg() and then conditionally call CommandExecutionContext.popFirstArg()
if you want to consume that input.public <T> void registerIssuerOnlyContext(Class<T> context, IssuerOnlyContextResolver<T,R> supplier)
public <T> void registerOptionalContext(Class<T> context, OptionalContextResolver<T,R> supplier)
CommandExecutionContext.popFirstArg()public <T> void registerContext(Class<T> context, ContextResolver<T,R> supplier)
CommandExecutionContext.popFirstArg()public ContextResolver<?,R> getResolver(Class<?> type)
Copyright © 2017. All rights reserved.