Class ConfigReferenceNotFoundContext

java.lang.Object
tech.guilhermekaua.spigotboot.config.reference.context.ConfigReferenceNotFoundContext

public final class ConfigReferenceNotFoundContext extends Object
Context object for config reference not found errors.

Provides information about where the reference was used and what alternatives are available.

  • Constructor Details

    • ConfigReferenceNotFoundContext

      public ConfigReferenceNotFoundContext(@NotNull @NotNull ReferenceKey sourceKey, @Nullable @Nullable Field sourceField, @NotNull @NotNull String fullReference, @NotNull @NotNull Set<String> availableAlternatives)
      Creates a new context.
      Parameters:
      sourceKey - the key of the config/item containing the reference
      sourceField - the field being bound (may be null for raw resolution)
      fullReference - the full reference string (e.g., "${items.diamond_sword}")
      availableAlternatives - suggested alternatives (config/folder config/item names)
  • Method Details

    • getSourceKey

      @NotNull public @NotNull ReferenceKey getSourceKey()
      Gets the key of the config or folder config item containing the reference.
      Returns:
      the source key
    • getSourceField

      @Nullable public @Nullable Field getSourceField()
      Gets the field being bound, if available.
      Returns:
      the field, or null if not binding to a specific field
    • getFullReference

      @NotNull public @NotNull String getFullReference()
      Gets the full reference string.
      Returns:
      the full reference (e.g., "${items.diamond_sword}")
    • getAvailableAlternatives

      @NotNull public @NotNull Set<String> getAvailableAlternatives()
      Gets suggested alternatives.

      May contain available config names, folder config names, or item IDs depending on what part of the reference was not found.

      Returns:
      set of suggested alternatives