class JaxbUtil {

    protected static Optional<ConstraintViolationException> unwrapConstraintViolationException(Throwable ex) {
        return Optional.of(ex)
                .map(Throwable::getCause)
                .filter(Objects::nonNull)
                .filter(ConstraintViolationException.class::isInstance)
                .map(ConstraintViolationException.class::cast);
    }

    private  JaxbUtil();

}