Class ConfigCircularReferenceContext
java.lang.Object
tech.guilhermekaua.spigotboot.config.reference.context.ConfigCircularReferenceContext
Context object for circular reference errors.
Provides information about the cycle chain that was detected.
-
Constructor Summary
ConstructorsConstructorDescriptionConfigCircularReferenceContext(@NotNull ReferenceKey sourceKey, @Nullable Field sourceField, @NotNull String fullReference, @NotNull List<ReferenceKey> resolutionChain) Creates a new context. -
Method Summary
Modifier and TypeMethodDescription@NotNull StringFormats the resolution chain as a readable string.@NotNull StringGets the full reference string that caused the cycle.@NotNull List<ReferenceKey>Gets the resolution chain showing the cycle.@Nullable FieldGets the field being bound, if available.@NotNull ReferenceKeyGets the key of the config or folder config item containing the reference.
-
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 referencesourceField- the field being bound (may be null for raw resolution)fullReference- the full reference string that caused the cycleresolutionChain- the chain of keys showing the cycle path
-
-
Method Details
-
getSourceKey
Gets the key of the config or folder config item containing the reference.- Returns:
- the source key
-
getSourceField
Gets the field being bound, if available.- Returns:
- the field, or null if not binding to a specific field
-
getFullReference
Gets the full reference string that caused the cycle.- Returns:
- the full reference
-
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
Formats the resolution chain as a readable string.- Returns:
- formatted chain string (e.g., "A -> B -> C -> A")
-