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 Summary
Modifier and TypeMethodDescription@Nullable ConfigNodefindFolderConfigItemPath(@NotNull String folderConfigName, @NotNull String itemId, @NotNull String path) Finds a node at a specific path within a folder config item.@Nullable ConfigNodefindFolderConfigItemRoot(@NotNull String folderConfigName, @NotNull String itemId) Finds the root node of a folder config item.@Nullable ConfigNodefindSingleConfigPath(@NotNull String configName, @NotNull String path) Finds a node at a specific path within a single config.@Nullable ConfigNodefindSingleConfigRoot(@NotNull String configName) Finds the root node of a single config by name.Gets all available single config names.Gets all available folder config names.getAvailableItemIds(@NotNull String folderConfigName) Gets all available item IDs within a folder config.getAvailableKeysAt(@NotNull String configName, @Nullable String path) Gets available keys at a path within a single config.booleanChecks if a single config exists.booleanhasFolderConfig(@NotNull String folderConfigName) Checks if a folder config exists.booleanhasFolderConfigItem(@NotNull String folderConfigName, @NotNull String itemId) Checks if a folder config item exists.default @Nullable ConfigNoderesolve(@NotNull ConfigReference reference) Resolves a config reference to its target node.
-
Method Details
-
findSingleConfigRoot
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 namepath- 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 nameitemId- the item IDpath- the dot-separated path- Returns:
- the node at the path, or null if folder config, item, or path not found
-
resolve
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
Gets all available single config names.Used for providing suggestions in error messages.
- Returns:
- set of config names
-
getAvailableFolderConfigNames
Gets all available folder config names.Used for providing suggestions in error messages.
- Returns:
- set of folder config names
-
getAvailableItemIds
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 namepath- 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
Checks if a single config exists.- Parameters:
configName- the config name- Returns:
- true if the config is registered
-
hasFolderConfig
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 nameitemId- the item ID- Returns:
- true if the item exists in the folder config
-