Package com.blazebit.annotation.constraint

Examples of com.blazebit.annotation.constraint.ConstraintValidator


          continue;
        }

        constraintValidatorClass = (Class<? extends ConstraintValidator>) getConstraintValidatorClass(
            memberAnnotationTypeElement, Constraint.class);
        ConstraintValidator validator = getConstraintValidator(
            constraintValidatorClass, constraintValidatorMap);

        if (validator != null) {
          for (Element e : roundEnv
              .getElementsAnnotatedWith(annotationType)) {
            validator.validate(processingEnv, roundEnv,
                annotationType, annotationMirror, e);
          }
        }
      }

      // validation processing for annotation member values
      for (ExecutableElement annotationMember : ElementFilter
          .methodsIn(annotationType.getEnclosedElements())) {
        // annotationMember is a method of an annotation
        for (AnnotationMirror annotationMirror : annotationMember
            .getAnnotationMirrors()) {
          // annotationMirror is an annotation on a method of an
          // annotation
          TypeElement memberAnnotationTypeElement = (TypeElement) annotationMirror
              .getAnnotationType().asElement();
          Class<? extends ValueConstraintValidator> constraintValidatorClass = null;

          if (shouldSkip(memberAnnotationTypeElement)) {
            continue;
          }

          constraintValidatorClass = (Class<? extends ValueConstraintValidator>) getConstraintValidatorClass(
              memberAnnotationTypeElement, ValueConstraint.class);
          ValueConstraintValidator validator = getConstraintValidator(
              constraintValidatorClass,
              valueConstraintValidatorMap);

          if (validator != null) {
            for (Element e : roundEnv
                .getElementsAnnotatedWith(annotationType)) {
              AnnotationMirror elementAnnotationMirror = AnnotationProcessingUtil
                  .findAnnotationMirror(processingEnv, e,
                      annotationType);
              Object actualValue = AnnotationProcessingUtil
                  .getAnnotationElementValue(
                      processingEnv,
                      elementAnnotationMirror,
                      annotationMember.getSimpleName()
                          .toString()).getValue();
              validator.validate(processingEnv, roundEnv,
                  annotationType, annotationMirror,
                  annotationMember, e, actualValue);
            }
          }
        }
View Full Code Here

TOP

Related Classes of com.blazebit.annotation.constraint.ConstraintValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.