@ApiStatus.Internal public final class BaseCommandRegistry<A extends CommandActor> extends java.lang.Object implements CommandRegistry<A>
| Constructor and Description |
|---|
BaseCommandRegistry(Lamp<A> lamp) |
BaseCommandRegistry(Lamp<A> lamp,
java.util.List<ExecutableCommand<A>> children) |
| 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.
|
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 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. |
java.util.List<ExecutableCommand<A>> |
register(@NotNull java.lang.Class<?> containerClass,
java.lang.Object instance) |
@NotNull @Unmodifiable java.util.List<ExecutableCommand<A>> |
register(@NotNull java.lang.Class<?> containerClass,
java.lang.Object instance,
@Nullable java.util.List<java.lang.String> orphanPaths) |
void |
unregister(@NotNull ExecutableCommand<A> execution)
Unregisters the given command.
|
void |
unregisterIf(@NotNull java.util.function.Predicate<ExecutableCommand<A>> matches)
Unregisters all commands that match a certain
Predicate criteria. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecutepublic BaseCommandRegistry(Lamp<A> lamp, java.util.List<ExecutableCommand<A>> children)
public java.util.List<ExecutableCommand<A>> register(@NotNull @NotNull java.lang.Class<?> containerClass, java.lang.Object instance)
@NotNull public @NotNull @Unmodifiable java.util.List<ExecutableCommand<A>> register(@NotNull @NotNull java.lang.Class<?> containerClass, java.lang.Object instance, @Nullable @Nullable java.util.List<java.lang.String> orphanPaths)
public void execute(@NotNull
A actor,
@NotNull
@NotNull ExecutableCommand<A> command,
@NotNull
@NotNull MutableStringStream input)
CommandRegistryCommandRegistry.execute(CommandActor, StringStream) as it does
not involve searching for the command.execute in interface CommandRegistry<A extends CommandActor>actor - The actor to execute the command withinput - The input to execute with@NotNull public @NotNull Lamp<A> lamp()
CommandRegistryLamp instance of this
registry.lamp in interface CommandRegistry<A extends CommandActor>public void execute(@NotNull
A actor,
@NotNull
@NotNull StringStream input)
CommandRegistryexecute in interface CommandRegistry<A extends CommandActor>actor - The actor to execute the command withinput - The input to execute with@NotNull public @NotNull @UnmodifiableView java.util.List<ExecutableCommand<A>> commands()
CommandRegistrycommands
registered in this registry.commands in interface CommandRegistry<A extends CommandActor>public void unregister(@NotNull
@NotNull ExecutableCommand<A> execution)
CommandRegistryunregister in interface CommandRegistry<A extends CommandActor>execution - The command to unregister.public boolean any(@NotNull
@NotNull java.util.function.Predicate<ExecutableCommand<A>> matches)
CommandRegistryany in interface CommandRegistry<A extends CommandActor>matches - Criteria to test for@NotNull public @NotNull java.util.List<ExecutableCommand<A>> filter(@NotNull @NotNull java.util.function.Predicate<ExecutableCommand<A>> filterPredicate)
CommandRegistryfilter in interface CommandRegistry<A extends CommandActor>filterPredicate - Criteria to test forpublic void unregisterIf(@NotNull
@NotNull java.util.function.Predicate<ExecutableCommand<A>> matches)
CommandRegistryPredicate criteria.unregisterIf in interface CommandRegistry<A extends CommandActor>matches - Criteria to test for@NotNull public @NotNull java.util.Iterator<ExecutableCommand<A>> iterator()
CommandRegistry
Attempting to modify the iterator will throw a UnsupportedOperationException.
iterator in interface java.lang.Iterable<ExecutableCommand<A extends CommandActor>>iterator in interface CommandRegistry<A extends CommandActor>