Module io.jooby.hibernate.validator
Package io.jooby.hibernate.validator
Class ConstraintViolationHandler
java.lang.Object
io.jooby.hibernate.validator.ConstraintViolationHandler
- All Implemented Interfaces:
ErrorHandler
Catches and transform
ConstraintViolationException into ValidationResult
Payload example:
{
"title": "Validation failed",
"status": 422,
"errors": [
{
"field": null,
"messages": [
"Passwords should match"
],
"type": "GLOBAL"
},
{
"field": "firstName",
"messages": [
"must not be empty",
"must not be null"
],
"type": "FIELD"
}
]
}
- Since:
- 3.3.1
- Author:
- kliushnichenko
-
Constructor Summary
ConstructorsConstructorDescriptionConstraintViolationHandler(StatusCode statusCode, String title, boolean logException, boolean problemDetailsEnabled) -
Method Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jooby.ErrorHandler
then
-
Constructor Details
-
ConstraintViolationHandler
public ConstraintViolationHandler(@NonNull StatusCode statusCode, @NonNull String title, boolean logException, boolean problemDetailsEnabled)
-
-
Method Details
-
apply
- Specified by:
applyin interfaceErrorHandler
-