A - The actor typepublic interface CommandRegistry<A extends CommandActor> extends java.lang.Iterable<ExecutableCommand<A>>
commands maintained by a
Lamp instance.
This can be accessed with Lamp.registry()
| Modifier and Type | Method and Description |
|---|---|
boolean |
any(@NotNull java.util.function.Predicate<ExecutableCommand<A>> matches)
Tests whether any of the registered commands matches the
given predicate
|
@NotNull @UnmodifiableView java.util.List<ExecutableCommand<A>> |
commands()
Gets an unmodifiable view of all the
commands
registered in this registry. |
void |
execute(A actor,
@NotNull ExecutableCommand<A> command,
@NotNull MutableStringStream input)
Executes the given command on the behalf of the actor.
|
default void |
execute(A actor,
@NotNull java.lang.String input)
Executes the given input on the behalf of the actor.
|
void |
execute(A actor,
@NotNull StringStream input)
Executes the given input on the behalf of the actor.
|
@NotNull java.util.List<ExecutableCommand<A>> |
filter(@NotNull java.util.function.Predicate<ExecutableCommand<A>> filterPredicate)
Returns a new list of all commands that match the
given predicate
|
@NotNull @UnmodifiableView java.util.Iterator<ExecutableCommand<A>> |
iterator()
Returns an immutable iterator of all entries in this registry.
|
@NotNull Lamp<A> |
lamp()
Returns the underlying
Lamp instance of this
registry. |
void |
unregister(@NotNull ExecutableCommand<A> command)
Unregisters the given command.
|
void |
unregisterIf(@NotNull java.util.function.Predicate<ExecutableCommand<A>> matches)
Unregisters all commands that match a certain
Predicate criteria. |
@NotNull @Contract(pure=true) @NotNull Lamp<A> lamp()
Lamp instance of this
registry.default void execute(@NotNull
A actor,
@NotNull
@NotNull java.lang.String input)
actor - The actor to execute the command withinput - The input to execute withvoid execute(@NotNull
A actor,
@NotNull
@NotNull StringStream input)
actor - The actor to execute the command withinput - The input to execute withvoid execute(@NotNull
A actor,
@NotNull
@NotNull ExecutableCommand<A> command,
@NotNull
@NotNull MutableStringStream input)
execute(CommandActor, StringStream) as it does
not involve searching for the command.actor - The actor to execute the command withinput - The input to execute with@NotNull @NotNull @UnmodifiableView java.util.List<ExecutableCommand<A>> commands()
commands
registered in this registry.void unregister(@NotNull
@NotNull ExecutableCommand<A> command)
command - The command to unregister.void unregisterIf(@NotNull
@NotNull java.util.function.Predicate<ExecutableCommand<A>> matches)
Predicate criteria.matches - Criteria to test forboolean any(@NotNull
@NotNull java.util.function.Predicate<ExecutableCommand<A>> matches)
matches - Criteria to test for@NotNull @CheckReturnValue @Contract(value="_ -> new") @NotNull java.util.List<ExecutableCommand<A>> filter(@NotNull @NotNull java.util.function.Predicate<ExecutableCommand<A>> filterPredicate)
filterPredicate - Criteria to test for@NotNull @NotNull @UnmodifiableView java.util.Iterator<ExecutableCommand<A>> iterator()
Attempting to modify the iterator will throw a UnsupportedOperationException.
iterator in interface java.lang.Iterable<ExecutableCommand<A extends CommandActor>>