private Annotation getAnnotationFromConstraintViolationException()

in ddm-rrm-rest-api/src/main/java/com/epam/digital/data/platform/management/restapi/exception/ApplicationExceptionHandler.java [418:428]


  private Annotation getAnnotationFromConstraintViolationException(
      ConstraintViolationException exception) {
    var constraintViolations = exception.getConstraintViolations();
    if (constraintViolations != null && !constraintViolations.isEmpty()) {
      var next = constraintViolations.iterator().next();
      if (next != null && next.getConstraintDescriptor() != null) {
        return next.getConstraintDescriptor().getAnnotation();
      }
    }
    return null;
  }