Class DefaultConfigReferenceLookup
java.lang.Object
tech.guilhermekaua.spigotboot.config.reference.DefaultConfigReferenceLookup
- All Implemented Interfaces:
ConfigReferenceLookup
Default platform-neutral implementation of
ConfigReferenceLookup.
Provides lookup capabilities for resolving config references by delegating
to DefaultConfigManager for single configs and FolderConfigEntry
for folder config items.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultConfigReferenceLookup(@NotNull DefaultConfigManager configManager) Creates a new lookup instance. -
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tech.guilhermekaua.spigotboot.config.reference.ConfigReferenceLookup
resolve
-
Constructor Details
-
DefaultConfigReferenceLookup
Creates a new lookup instance.- Parameters:
configManager- the config manager providing access to configs and folder configs
-
-
Method Details
-
findSingleConfigRoot
Description copied from interface:ConfigReferenceLookupFinds the root node of a single config by name.- Specified by:
findSingleConfigRootin interfaceConfigReferenceLookup- Parameters:
configName- the config name (from@Config(name="..."))- Returns:
- the root config node, or null if not found
-
findSingleConfigPath
@Nullable public @Nullable ConfigNode findSingleConfigPath(@NotNull @NotNull String configName, @NotNull @NotNull String path) Description copied from interface:ConfigReferenceLookupFinds a node at a specific path within a single config.- Specified by:
findSingleConfigPathin interfaceConfigReferenceLookup- 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 public @Nullable ConfigNode findFolderConfigItemRoot(@NotNull @NotNull String folderConfigName, @NotNull @NotNull String itemId) Description copied from interface:ConfigReferenceLookupFinds the root node of a folder config item.- Specified by:
findFolderConfigItemRootin interfaceConfigReferenceLookup- 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 public @Nullable ConfigNode findFolderConfigItemPath(@NotNull @NotNull String folderConfigName, @NotNull @NotNull String itemId, @NotNull @NotNull String path) Description copied from interface:ConfigReferenceLookupFinds a node at a specific path within a folder config item.- Specified by:
findFolderConfigItemPathin interfaceConfigReferenceLookup- 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
-
getAvailableConfigNames
Description copied from interface:ConfigReferenceLookupGets all available single config names.Used for providing suggestions in error messages.
- Specified by:
getAvailableConfigNamesin interfaceConfigReferenceLookup- Returns:
- set of config names
-
getAvailableFolderConfigNames
Description copied from interface:ConfigReferenceLookupGets all available folder config names.Used for providing suggestions in error messages.
- Specified by:
getAvailableFolderConfigNamesin interfaceConfigReferenceLookup- Returns:
- set of folder config names
-
getAvailableItemIds
Description copied from interface:ConfigReferenceLookupGets all available item IDs within a folder config.Used for providing suggestions in error messages.
- Specified by:
getAvailableItemIdsin interfaceConfigReferenceLookup- Parameters:
folderConfigName- the folder config name- Returns:
- set of item IDs, or empty set if folder config not found
-
getAvailableKeysAt
@NotNull public @NotNull Set<String> getAvailableKeysAt(@NotNull @NotNull String configName, @Nullable @Nullable String path) Description copied from interface:ConfigReferenceLookupGets 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.
- Specified by:
getAvailableKeysAtin interfaceConfigReferenceLookup- 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
Description copied from interface:ConfigReferenceLookupChecks if a single config exists.- Specified by:
hasConfigin interfaceConfigReferenceLookup- Parameters:
configName- the config name- Returns:
- true if the config is registered
-
hasFolderConfig
Description copied from interface:ConfigReferenceLookupChecks if a folder config exists.- Specified by:
hasFolderConfigin interfaceConfigReferenceLookup- Parameters:
folderConfigName- the folder config name- Returns:
- true if the folder config is registered
-
hasFolderConfigItem
public boolean hasFolderConfigItem(@NotNull @NotNull String folderConfigName, @NotNull @NotNull String itemId) Description copied from interface:ConfigReferenceLookupChecks if a folder config item exists.- Specified by:
hasFolderConfigItemin interfaceConfigReferenceLookup- Parameters:
folderConfigName- the folder config nameitemId- the item ID- Returns:
- true if the item exists in the folder config
-