public void startElement(String uri, String localName, String qName, Attributes attributes)
          throws SAXException {

        if (DEFAULT_PACKAGE_QNAME.equalsIgnoreCase(qName)) {
          defaultPackageElement = true;
        } else if (BEAN_QNAME.equalsIgnoreCase(qName)) {
          String className = defaultPackage + PACKAGE_SEPARATOR + attributes.getValue(CLASS_QNAME);
          if (LOGGER.isLoggable(Level.INFO)) {
            String msg = "Detected external constraints on class " + className;
            LOGGER.info(msg);
          }
          try {
            Class<?> clazz = ReflectionUtils.forName(className);
            BEAN_VALIDATION_HELPER.putConstrainedClass(clazz);
          } catch (ClassNotFoundException e) {
            String errMsg = "Loading found class failed. Exception: " + e.getMessage();
            LOGGER.warning(errMsg);
          }
        }
      }
 private void validateOnCallbackEvent(
     DescriptorEvent event, String callbackEventName, Class[] validationGroup) {
   Object source = event.getSource();
   boolean shouldValidate = BEAN_VALIDATION_HELPER.isConstrained(source.getClass());
   if (shouldValidate) {
     Set<ConstraintViolation<Object>> constraintViolations =
         getValidator(event).validate(source, validationGroup);
     if (constraintViolations.size() > 0) {
       // There were errors while call to validate above.
       // Throw a ConstrainViolationException as required by the spec.
       // The transaction would be rolled back automatically
       // TODO need to I18N this.
       throw new ConstraintViolationException(
           "Bean Validation constraint(s) violated while executing Automatic Bean Validation on callback event:'"
               + callbackEventName
               + "'. Please refer to embedded ConstraintViolations for details.",
           (Set<ConstraintViolation<?>>)
               (Object) constraintViolations); /* Do not remove the explicit
                       cast. This issue is related to capture#a not being instance of capture#b. */
     }
   }
 }