Class ConfigCircularReferenceContext

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

public final class ConfigCircularReferenceContext extends Object
Context object for circular reference errors.

Provides information about the cycle chain that was detected.

  • Constructor Details

    • ConfigCircularReferenceContext

      public ConfigCircularReferenceContext(@NotNull @NotNull ReferenceKey sourceKey, @Nullable @Nullable Field sourceField, @NotNull @NotNull String fullReference, @NotNull @NotNull List<ReferenceKey> resolutionChain)
      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 that caused the cycle
      resolutionChain - the chain of keys showing the cycle path
  • 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 that caused the cycle.
      Returns:
      the full reference
    • getResolutionChain

      @NotNull public @NotNull List<ReferenceKey> getResolutionChain()
      Gets the resolution chain showing the cycle.

      The chain shows the path of references that led to the cycle. The last element typically points back to an earlier element, forming the cycle.

      Returns:
      the resolution chain
    • formatChain

      @NotNull public @NotNull String formatChain()
      Formats the resolution chain as a readable string.
      Returns:
      formatted chain string (e.g., "A -> B -> C -> A")