public interface ConstraintViolation
Violation of a constraint.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumLocation of the violation.static interfaceA path element of a constraint violation. -
Method Summary
Modifier and TypeMethodDescriptionAnnotation that triggered the constraint validation.The value that failed validation.location()Location of the failure.message()Descriptive message of the failure.Root validated object.Class<?> rootType()The type of the root validated object, or the class containing the element that is validated.
-
Method Details
-
message
String message()Descriptive message of the failure.- Returns:
- message
-
location
List<ConstraintViolation.PathElement> location()Location of the failure.- Returns:
- location
-
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
-