Class CommandRegistry

java.lang.Object
org.springframework.shell.core.command.CommandRegistry
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware

public class CommandRegistry extends Object implements org.springframework.beans.factory.SmartInitializingSingleton, org.springframework.context.ApplicationContextAware
Class representing a registry of Commands. If defined as a Spring bean, it will be automatically populated by Spring with all available commands. Commands can also be registered and unregistered at runtime.

Commands are uniquely identified by their name.

Author:
Janne Valkealahti, Piotr Olaszewski, Mahmoud Ben Hassine
  • Constructor Details

    • CommandRegistry

      public CommandRegistry()
    • CommandRegistry

      public CommandRegistry(Set<Command> commands)
  • Method Details

    • getCommands

      public Set<Command> getCommands()
    • getCommandByName

      public @Nullable Command getCommandByName(String name)
    • getCommandByAlias

      public @Nullable Command getCommandByAlias(String name)
    • getCommandsByPrefix

      public List<Command> getCommandsByPrefix(String prefix)
    • registerCommand

      public void registerCommand(Command command)
    • unregisterCommand

      public void unregisterCommand(Command command)
    • clearCommands

      public void clearCommands()
    • afterSingletonsInstantiated

      public void afterSingletonsInstantiated()
      Specified by:
      afterSingletonsInstantiated in interface org.springframework.beans.factory.SmartInitializingSingleton
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException