Class ConfigReference

java.lang.Object
tech.guilhermekaua.spigotboot.config.reference.ConfigReference

public final class ConfigReference extends Object
Immutable representation of a parsed config reference token.

Reference syntax supports:

  • ${configName} - single config root
  • ${configName:path.to.value} - single config with path
  • ${folderConfigName.itemId} - folder config item root
  • ${folderConfigName.itemId:path.to.value} - folder config item with path
  • Method Details

    • singleConfig

      @NotNull public static @NotNull ConfigReference singleConfig(@NotNull @NotNull String rawToken, @NotNull @NotNull String configName, @Nullable @Nullable String path)
      Creates a reference to a single config.
      Parameters:
      rawToken - the original token string (e.g., "${configName:path}")
      configName - the config name
      path - the path within the config, or null for root
      Returns:
      the config reference
    • folderConfigItem

      @NotNull public static @NotNull ConfigReference folderConfigItem(@NotNull @NotNull String rawToken, @NotNull @NotNull String folderConfigName, @NotNull @NotNull String itemId, @Nullable @Nullable String path)
      Creates a reference to a folder config item.
      Parameters:
      rawToken - the original token string
      folderConfigName - the folder config name
      itemId - the item ID within the folder config
      path - the path within the item, or null for root
      Returns:
      the config reference
    • getRawToken

      @NotNull public @NotNull String getRawToken()
      Gets the original raw token string (e.g., "${items:items.custom_exp_bottle}").
      Returns:
      the raw token
    • getKind

      @NotNull public @NotNull ReferenceTargetKind getKind()
      Gets the kind of reference target.
      Returns:
      the target kind
    • getTargetName

      @NotNull public @NotNull String getTargetName()
      Gets the target name.

      For ReferenceTargetKind.SINGLE_CONFIG, this is the config name. For ReferenceTargetKind.FOLDER_CONFIG_ITEM, this is the folder config name.

      Returns:
      the target name
    • getConfigName

      @NotNull public @NotNull String getConfigName()
      Gets the config name for single config references.
      Returns:
      the config name
      Throws:
      IllegalStateException - if this is not a single config reference
    • getFolderConfigName

      @NotNull public @NotNull String getFolderConfigName()
      Gets the folder config name for folder config item references.
      Returns:
      the folder config name
      Throws:
      IllegalStateException - if this is not a folder config item reference
    • getItemId

      @Nullable public @Nullable String getItemId()
      Gets the item ID for folder config item references.
      Returns:
      the item ID, or null if this is a single config reference
    • getPath

      @Nullable public @Nullable String getPath()
      Gets the path within the target config/item.
      Returns:
      the path, or null if referencing the root
    • isRootReference

      public boolean isRootReference()
      Checks if this reference targets the root of the config/item.
      Returns:
      true if no path is specified
    • isSingleConfig

      public boolean isSingleConfig()
      Checks if this reference targets a single config.
      Returns:
      true if single config reference
    • isFolderConfigItem

      public boolean isFolderConfigItem()
      Checks if this reference targets a folder config item.
      Returns:
      true if folder config item reference