Interface Constraint<T>

Type Parameters:
T - the type this constraint validates

public interface Constraint<T>
A validation constraint that can check if a value is valid.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this constraint should fail fast.
    boolean
    isValid(T value)
    Checks if the value is valid.
    @NotNull String
    message(T value)
    Gets the error message for an invalid value.
    default @Nullable String
    suggestedFix(T value)
    Gets an optional suggested fix for the invalid value.
  • Method Details

    • isValid

      boolean isValid(@Nullable T value)
      Checks if the value is valid.
      Parameters:
      value - the value to check
      Returns:
      true if valid
    • message

      @NotNull @NotNull String message(@Nullable T value)
      Gets the error message for an invalid value.
      Parameters:
      value - the invalid value
      Returns:
      the error message
    • isFailFast

      boolean isFailFast()
      Checks if this constraint should fail fast.
      Returns:
      true if validation failure should prevent plugin loading
    • suggestedFix

      @Nullable default @Nullable String suggestedFix(@Nullable T value)
      Gets an optional suggested fix for the invalid value.
      Parameters:
      value - the invalid value
      Returns:
      the suggested fix, or null