Interface FlagRegistrar<S extends Source>

Type Parameters:
S - the type of source that extends the Source class, representing the origin or context of the command (e.g., a user, a system, etc.).
All Known Subinterfaces:
Command<S>

public interface FlagRegistrar<S extends Source>
The FlagRegistrar interface is responsible for managing the registration and retrieval of free flags in the Imperat command framework. Free flags are flags that can be used anywhere in the command syntax, without being tied to a specific position or index.
  • Method Details

    • registerFlag

      void registerFlag(FlagData<S> flagBuilder)
      Registers a new free flag in the system.
      Parameters:
      flagBuilder - the FlagData object containing the data required to define and register the flag. This includes the flag's name, aliases, description, and any associated logic or behavior.
    • getFlagFromRaw

      Optional<FlagData<S>> getFlagFromRaw(String raw)
      Retrieves a registered flag based on its raw input (e.g., a string provided by the user in a command).
      Parameters:
      raw - the raw input string that may represent a flag (e.g., --help, -h).
      Returns:
      an Optional containing the FlagData object if a matching flag is found. If no match is found, the Optional will be empty.
    • getRegisteredFlags

      Set<FlagData<S>> getRegisteredFlags()
      Retrieves all registered flags in the system.
      Returns:
      a Set containing all FlagData objects that have been registered.