Interface ConstraintViolation


public interface ConstraintViolation
Violation of a constraint.
  • Method Details

    • message

      String message()
      Descriptive message of the failure.
      Returns:
      message
    • location

      Location of the failure.
      Returns:
      location
    • rootObject

      Optional<Object> rootObject()
      Root validated object. When validating an instance, this returns the same instance, when validating a method, field, parameter etc., this returns the instance containing the validated element. When validating a constructor, this returns empty.
      Returns:
      the root of validation, or empty if not available
    • rootType

      Class<?> rootType()
      The type of the root validated object, or the class containing the element that is validated.
      Returns:
      root type
    • invalidValue

      Object invalidValue()
      The value that failed validation.

      Note: this method may return null!

      Returns:
      the value that failed validation
    • annotation

      Annotation annotation()
      Annotation that triggered the constraint validation.
      Returns:
      annotation