Class ConfigTypeMismatchContext

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

public final class ConfigTypeMismatchContext extends Object
Context object for type mismatch errors during reference resolution.

Provides information about the expected type, actual type, and the resolved value.

  • Constructor Details

    • ConfigTypeMismatchContext

      public ConfigTypeMismatchContext(@NotNull @NotNull ReferenceKey sourceKey, @Nullable @Nullable Field sourceField, @NotNull @NotNull String fullReference, @NotNull @NotNull Type expectedType, @NotNull @NotNull Class<?> actualType, @Nullable @Nullable Object actualValue)
      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
      expectedType - the expected type for the field
      actualType - the actual type of the resolved value
      actualValue - the actual resolved value (may be null)
  • 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
    • getExpectedType

      @NotNull public @NotNull Type getExpectedType()
      Gets the expected type for the target field.
      Returns:
      the expected type
    • getActualType

      @NotNull public @NotNull Class<?> getActualType()
      Gets the actual type of the resolved value.
      Returns:
      the actual type
    • getActualValue

      @Nullable public @Nullable Object getActualValue()
      Gets the actual resolved value.
      Returns:
      the actual value, may be null