Class ValidationError

java.lang.Object
tech.guilhermekaua.spigotboot.core.validation.ValidationError

public final class ValidationError extends Object
Represents a validation error for a field.
  • Constructor Details

    • ValidationError

      public ValidationError(@NotNull @NotNull PropertyPath path, @NotNull @NotNull String fieldName, @Nullable @Nullable Object invalidValue, @NotNull @NotNull String message, boolean failFast, @Nullable @Nullable String suggestedFix)
      Creates a new validation error.
      Parameters:
      path - the property path to the invalid value
      fieldName - the field name
      invalidValue - the invalid value
      message - the error message
      failFast - whether this error should prevent plugin loading
      suggestedFix - an optional suggested fix
  • Method Details

    • getPath

      @NotNull public @NotNull PropertyPath getPath()
      Gets the property path to the invalid value.
      Returns:
      the property path
    • getFieldName

      @NotNull public @NotNull String getFieldName()
      Gets the field name.
      Returns:
      the field name
    • getInvalidValue

      @Nullable public @Nullable Object getInvalidValue()
      Gets the invalid value.
      Returns:
      the invalid value
    • getMessage

      @NotNull public @NotNull String getMessage()
      Gets the error message.
      Returns:
      the error message
    • isFailFast

      public boolean isFailFast()
      Checks if this error should fail fast.
      Returns:
      true if fail fast
    • getSuggestedFix

      @Nullable public @Nullable String getSuggestedFix()
      Gets the suggested fix.
      Returns:
      the suggested fix, or null
    • format

      @NotNull public @NotNull String format()
      Formats this error for display.
      Returns:
      the formatted error message
    • toString

      public String toString()
      Overrides:
      toString in class Object