Interface ConfigReferenceLookup

All Known Implementing Classes:
DefaultConfigReferenceLookup

public interface ConfigReferenceLookup
Provides lookup capabilities for resolving config references.

This interface abstracts the underlying config storage (single configs and folder configs) so that the reference resolver can fetch raw config nodes without knowing the implementation details.

  • Method Details

    • findSingleConfigRoot

      @Nullable @Nullable ConfigNode findSingleConfigRoot(@NotNull @NotNull String configName)
      Finds the root node of a single config by name.
      Parameters:
      configName - the config name (from @Config(name="..."))
      Returns:
      the root config node, or null if not found
    • findSingleConfigPath

      @Nullable @Nullable ConfigNode findSingleConfigPath(@NotNull @NotNull String configName, @NotNull @NotNull String path)
      Finds a node at a specific path within a single config.
      Parameters:
      configName - the config name
      path - the dot-separated path (e.g., "database.host")
      Returns:
      the node at the path, or null if config or path not found
    • findFolderConfigItemRoot

      @Nullable @Nullable ConfigNode findFolderConfigItemRoot(@NotNull @NotNull String folderConfigName, @NotNull @NotNull String itemId)
      Finds the root node of a folder config item.
      Parameters:
      folderConfigName - the folder config name (from @FolderConfig(name="..."))
      itemId - the item ID (typically the filename without extension)
      Returns:
      the root node of the item, or null if not found
    • findFolderConfigItemPath

      @Nullable @Nullable ConfigNode findFolderConfigItemPath(@NotNull @NotNull String folderConfigName, @NotNull @NotNull String itemId, @NotNull @NotNull String path)
      Finds a node at a specific path within a folder config item.
      Parameters:
      folderConfigName - the folder config name
      itemId - the item ID
      path - the dot-separated path
      Returns:
      the node at the path, or null if folder config, item, or path not found
    • resolve

      @Nullable default @Nullable ConfigNode resolve(@NotNull @NotNull ConfigReference reference)
      Resolves a config reference to its target node.

      This is a convenience method that dispatches to the appropriate find method based on the reference type.

      Parameters:
      reference - the config reference
      Returns:
      the target node, or null if not found
    • getAvailableConfigNames

      @NotNull @NotNull Set<String> getAvailableConfigNames()
      Gets all available single config names.

      Used for providing suggestions in error messages.

      Returns:
      set of config names
    • getAvailableFolderConfigNames

      @NotNull @NotNull Set<String> getAvailableFolderConfigNames()
      Gets all available folder config names.

      Used for providing suggestions in error messages.

      Returns:
      set of folder config names
    • getAvailableItemIds

      @NotNull @NotNull Set<String> getAvailableItemIds(@NotNull @NotNull String folderConfigName)
      Gets all available item IDs within a folder config.

      Used for providing suggestions in error messages.

      Parameters:
      folderConfigName - the folder config name
      Returns:
      set of item IDs, or empty set if folder config not found
    • getAvailableKeysAt

      @NotNull @NotNull Set<String> getAvailableKeysAt(@NotNull @NotNull String configName, @Nullable @Nullable String path)
      Gets available keys at a path within a single config.

      If the node at the path is a map, returns its keys. Used for providing suggestions in error messages.

      Parameters:
      configName - the config name
      path - the path (can be empty or null for root)
      Returns:
      set of available keys, or empty set if not a map or not found
    • hasConfig

      boolean hasConfig(@NotNull @NotNull String configName)
      Checks if a single config exists.
      Parameters:
      configName - the config name
      Returns:
      true if the config is registered
    • hasFolderConfig

      boolean hasFolderConfig(@NotNull @NotNull String folderConfigName)
      Checks if a folder config exists.
      Parameters:
      folderConfigName - the folder config name
      Returns:
      true if the folder config is registered
    • hasFolderConfigItem

      boolean hasFolderConfigItem(@NotNull @NotNull String folderConfigName, @NotNull @NotNull String itemId)
      Checks if a folder config item exists.
      Parameters:
      folderConfigName - the folder config name
      itemId - the item ID
      Returns:
      true if the item exists in the folder config