A - The actor typepublic interface ExecutionContext<A extends CommandActor>
| Modifier and Type | Method and Description |
|---|---|
A |
actor()
Returns the actor executing this command
|
@NotNull ExecutableCommand<A> |
command()
Returns the command being executed
|
static <A extends CommandActor> |
create(@NotNull ExecutableCommand<A> command,
A actor,
@NotNull StringStream input)
Creates a new
MutableExecutionContext for the given command, actor
and input. |
static <A extends CommandActor> |
createMutable(@NotNull ExecutableCommand<A> command,
A actor,
@NotNull StringStream input)
Creates a new
MutableExecutionContext for the given command, actor
and input. |
default <T> T |
getResolvedArgument(@NotNull java.lang.Class<T> argumentType)
Returns the first argument that matches the given type, or throws
an
IllegalArgumentException if not found. |
default <T> T |
getResolvedArgument(@NotNull java.lang.String argumentName)
Returns the first argument that matches the given type, or throws
an
IllegalArgumentException if not found. |
<T> T |
getResolvedArgumentOrNull(@NotNull java.lang.Class<T> argumentType)
Returns the first argument that matches the given type
|
<T> T |
getResolvedArgumentOrNull(@NotNull java.lang.String argumentName)
Returns the argument that has been resolved with the given name
|
@NotNull StringStream |
input()
Returns the underlying
StringStream of this context. |
@NotNull Lamp<A> |
lamp()
Returns the
Lamp instance that is executing this
command |
@NotNull @UnmodifiableView java.util.Map<java.lang.String,java.lang.Object> |
resolvedArguments()
Returns the arguments that have been resolved, each mapped to the
parameter name.
|
@Contract(value="_,_,_ -> new") @NotNull static <A extends CommandActor> @NotNull MutableExecutionContext<A> createMutable(@NotNull @NotNull ExecutableCommand<A> command, @NotNull A actor, @NotNull @NotNull StringStream input)
MutableExecutionContext for the given command, actor
and input. This can be modified and used to generate execution contexts from
different platforms.A - The actor typecommand - The executed commandactor - The actor executing the commandinput - The command input.@Contract(value="_,_,_ -> new") @NotNull static <A extends CommandActor> @NotNull ExecutionContext<A> create(@NotNull @NotNull ExecutableCommand<A> command, @NotNull A actor, @NotNull @NotNull StringStream input)
MutableExecutionContext for the given command, actor
and input. This can be modified and used to generate execution contexts from
different platforms.A - The actor typecommand - The executed commandactor - The actor executing the commandinput - The command input.@NotNull A actor()
@NotNull @NotNull Lamp<A> lamp()
Lamp instance that is executing this
commandLamp instance@NotNull @NotNull ExecutableCommand<A> command()
@NotNull @NotNull @UnmodifiableView java.util.Map<java.lang.String,java.lang.Object> resolvedArguments()
@NotNull @NotNull StringStream input()
StringStream of this context. Note
that this may not always be in the expected format, as it is
generated from a platform-specific format.@Nullable
<T> T getResolvedArgumentOrNull(@NotNull
@NotNull java.lang.String argumentName)
T - The parameter typeargumentName - The argument name@Nullable
<T> T getResolvedArgumentOrNull(@NotNull
@NotNull java.lang.Class<T> argumentType)
T - The parameter typeargumentType - The argument type@NotNull
default <T> T getResolvedArgument(@NotNull
@NotNull java.lang.String argumentName)
IllegalArgumentException if not found.T - The parameter typeargumentName - The argument namejava.lang.IllegalArgumentException - if no such parameter found@NotNull
default <T> T getResolvedArgument(@NotNull
@NotNull java.lang.Class<T> argumentType)
IllegalArgumentException if not found.T - The parameter typeargumentType - The argument typejava.lang.IllegalArgumentException - if no such parameter found