Class CommandRegistry

java.lang.Object
net.minheur.potoflux.terminal.CommandRegistry
All Implemented Interfaces:
IRegistry<Command>

public class CommandRegistry extends Object implements IRegistry<Command>
Reg containing all commands of the app.
Commands should be added to this
  • Constructor Details

    • CommandRegistry

      public CommandRegistry()
  • Method Details

    • getAll

      public static Collection<Command> getAll()
      Getter for all commands
      Returns:
      all commands
    • add

      public Command add(Command item)
      Adds a command to the reg
      Specified by:
      add in interface IRegistry<Command>
      Parameters:
      item - command to add to the reg
      Returns:
      the added command
    • containsKey

      public static boolean containsKey(String pKey)
      Checks if a key is already used by another command
      Parameters:
      pKey - command key to check if used
      Returns:
      if the key is already used
    • getCommandWithKey

      public static Command getCommandWithKey(String pKey)
      Gets a command object from his key
      Parameters:
      pKey - command key to get the command from
      Returns:
      the command associated to the key, or null if the command doesn't exist