Class SystemCommandManager

java.lang.Object
com.tenio.common.logger.AbstractLogger
com.tenio.common.logger.SystemLogger
com.tenio.core.command.system.SystemCommandManager

@Component public final class SystemCommandManager extends com.tenio.common.logger.SystemLogger
The commands' management class.
Since:
0.4.0
  • Constructor Details

    • SystemCommandManager

      public SystemCommandManager()
  • Method Details

    • registerCommand

      public void registerCommand(String label, AbstractSystemCommandHandler command)
      Registers a command handler.
      Parameters:
      label - The command label
      command - The command handler
    • unregisterCommand

      public void unregisterCommand(String label)
      Removes a registered command handler.
      Parameters:
      label - The command label
    • getAnnotationsAsList

      public List<SystemCommand> getAnnotationsAsList()
      Retrieves the annotations list.
      Returns:
      a List of annotations
      See Also:
    • getAnnotations

      public Map<String,SystemCommand> getAnnotations()
      Retrieves the annotations map.
      Returns:
      a Map of annotations
      See Also:
    • getHandlersAsList

      public List<AbstractSystemCommandHandler> getHandlersAsList()
      Returns a list of all registered commands.
      Returns:
      all command handlers as a list
    • getHandlers

      public Map<String,AbstractSystemCommandHandler> getHandlers()
      Retrieves all handlers.
      Returns:
      a Map of all handlers which are managed
    • getHandler

      public AbstractSystemCommandHandler getHandler(String label)
      Returns a handler by its label
      Parameters:
      label - The command label
      Returns:
      the command handler
    • invoke

      public void invoke(String rawMessage)
      Invokes a command handler with given arguments.
      Parameters:
      rawMessage - The messaged used to invoke the command
    • clear

      public void clear()
      Clear all settings.