Interface Registry
- All Known Implementing Classes:
SimpleRegistry
- Since:
- 1.0
- Version:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionfindCommand(Invocation invocation, Class<H> type) Retrieves the best command known to this registry that has the given parent and name, and is compatible with the given type.getCommand(String id) Retrieves the command with the given ID that is registered to this registry.<H extends Handlers>
Collection<Command<? extends H>>getCommands(Class<H> type) Retrieves all commands known to this registry that are compatible with the given type.booleanregisterCommand(Command<?> command) Registers a command into this registry.default voidregisterCommands(Command<?>... commands) Registers the given commands into this registry.default voidregisterCommands(CommandGroup commands) Registers the given commands into this registry.default voidregisterCommands(Collection<? extends Command<?>> commands) Registers the given commands into this registry.removeCommand(String id) Removes a command from this registry that was registered with the given ID.
-
Method Details
-
findCommand
@Pure <H extends Handlers> @Nullable Command<? extends H> findCommand(Invocation invocation, Class<H> type) Retrieves the best command known to this registry that has the given parent and name, and is compatible with the given type.- Type Parameters:
H- The handler type that must be supported.- Parameters:
invocation- The invocation of the command.type- The handler type.- Returns:
- The best matching command known to this registry, or
nullif none were found.
-
getCommands
Retrieves all commands known to this registry that are compatible with the given type.- Type Parameters:
H- The handler type that must be supported.- Parameters:
type- The handler type.- Returns:
- The compatible commands known to this registry.
-
getCommand
Retrieves the command with the given ID that is registered to this registry.- Parameters:
id- TheIDof the command to retrieve.- Returns:
- The command that was registered with the given ID, or
nullif there is no such command in this registry.
-
registerCommand
Registers a command into this registry.- Parameters:
command- The command to register.- Returns:
trueif the command was registered successfully.falseif there is already a command in this registry with the given ID, or if there is already a command known to this registry with the given signature and this registry does not allow overriding. Iffalse, the registration failed and the call had no effect.- Throws:
IllegalArgumentException- if the given command has an invalid configuration.
-
registerCommands
Registers the given commands into this registry.For each of the commands that cannot be added (due to being invalid or using an ID that is already used by another command), if any, an error will be logged but otherwise it will be silently ignored. If handling of those cases is necessary, use
registerCommand(Command)directly.- Parameters:
commands- The commands to add.
-
registerCommands
Registers the given commands into this registry.For each of the commands that cannot be added (due to being invalid or using an ID that is already used by another command), if any, an error will be logged but otherwise it will be silently ignored. If handling of those cases is necessary, use
registerCommand(Command)directly.- Parameters:
commands- The commands to add.
-
registerCommands
Registers the given commands into this registry.For each of the commands that cannot be added (due to being invalid or using an ID that is already used by another command), if any, an error will be logged but otherwise it will be silently ignored. If handling of those cases is necessary, use
registerCommand(Command)directly.- Parameters:
commands- The commands to add.
-
removeCommand
Removes a command from this registry that was registered with the given ID.- Parameters:
id- TheIDof the command to remove.- Returns:
- The removed command, or
nullif there was no command in this registry registered with the given ID.
-