Interface ConstraintViolationAdviceTrait
-
- All Superinterfaces:
AdviceTrait,AdviceTrait
- All Known Subinterfaces:
ProblemHandling,ValidationAdviceTrait
@API(status=STABLE) public interface ConstraintViolationAdviceTrait- See Also:
ConstraintViolationException,Violation,ConstraintViolationProblem,ConstraintViolationProblem.TYPE_VALUE,BaseValidationAdviceTrait.defaultConstraintViolationStatus()
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default ViolationcreateViolation(javax.validation.ConstraintViolation violation)default org.zalando.problem.StatusTypedefaultConstraintViolationStatus()default URIdefaultConstraintViolationType()default StringformatFieldName(String fieldName)Format the name of a violating field (e.g.default org.springframework.http.ResponseEntity<org.zalando.problem.Problem>handleConstraintViolation(javax.validation.ConstraintViolationException exception, org.springframework.web.context.request.NativeWebRequest request)default org.springframework.http.ResponseEntity<org.zalando.problem.Problem>newConstraintViolationProblem(Throwable throwable, Collection<Violation> stream, org.springframework.web.context.request.NativeWebRequest request)-
Methods inherited from interface org.zalando.problem.spring.common.AdviceTrait
createStackTrace, isCausalChainsEnabled, prepare, process, resolveResponseStatus, toProblem, toProblem, toProblem
-
-
-
-
Method Detail
-
handleConstraintViolation
@API(status=INTERNAL) @ExceptionHandler default org.springframework.http.ResponseEntity<org.zalando.problem.Problem> handleConstraintViolation(javax.validation.ConstraintViolationException exception, org.springframework.web.context.request.NativeWebRequest request)
-
createViolation
default Violation createViolation(javax.validation.ConstraintViolation violation)
-
defaultConstraintViolationType
default URI defaultConstraintViolationType()
-
defaultConstraintViolationStatus
default org.zalando.problem.StatusType defaultConstraintViolationStatus()
-
formatFieldName
default String formatFieldName(String fieldName)
Format the name of a violating field (e.g. lower camel to snake case)- Parameters:
fieldName- the field name to format- Returns:
- the formatted field name, defaults to the parameter, i.e. doesn't apply any transformation
-
newConstraintViolationProblem
default org.springframework.http.ResponseEntity<org.zalando.problem.Problem> newConstraintViolationProblem(Throwable throwable, Collection<Violation> stream, org.springframework.web.context.request.NativeWebRequest request)
-
-