Module utility.exception.mapper
Class DomainInvariantViolationExceptionMapper
java.lang.Object
uk.co.jasonmarston.kiunzi.utility.exception.mapper.DomainInvariantViolationExceptionMapper
- All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.validator.DomainInvariantViolationException>
@Provider
public class DomainInvariantViolationExceptionMapper
extends Object
implements jakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.validator.DomainInvariantViolationException>
Maps
DomainInvariantViolationException instances to HTTP 409 responses
with detailed validation errors.
Each domain violation is converted into a
ValidationErrorResponse.Violation entry so clients can identify the field
or property that caused the conflict.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a mapper for domain invariant violations. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsetoResponse(uk.co.jasonmarston.kiunzi.utility.validator.DomainInvariantViolationException ex) Converts the supplied domain invariant violation into an HTTP response.
-
Constructor Details
-
DomainInvariantViolationExceptionMapper
public DomainInvariantViolationExceptionMapper()Creates a mapper for domain invariant violations.
-
-
Method Details
-
toResponse
public jakarta.ws.rs.core.Response toResponse(uk.co.jasonmarston.kiunzi.utility.validator.DomainInvariantViolationException ex) Converts the supplied domain invariant violation into an HTTP response.- Specified by:
toResponsein interfacejakarta.ws.rs.ext.ExceptionMapper<uk.co.jasonmarston.kiunzi.utility.validator.DomainInvariantViolationException>- Parameters:
ex- the domain invariant violation raised while processing the request- Returns:
- an HTTP 409 response containing a
ValidationErrorResponsebody
-