Package javax.lang.model.element

Examples of javax.lang.model.element.AnnotationMirror


    return autoResolvable;
  }

  @SuppressWarnings("unchecked")
  private static List<AnnotationValue> readCRef(Element element) {
    AnnotationMirror cref = ProcessorUtil.mirror(Bind.class, element);
    if (cref == null)
      return Collections.emptyList();
   
    AnnotationValue components = readAnnotationField(cref, "value");
    return (List<AnnotationValue>)components.getValue();
View Full Code Here


      DeclaredType constraintAnnotationType, TypeMirror type) {

    Set<TypeMirror> theValue = CollectionHelper.newHashSet();

    //the Constraint meta-annotation at the type declaration, e.g. "@Constraint(validatedBy = CheckCaseValidator.class)"
    AnnotationMirror constraintMetaAnnotation = getConstraintMetaAnnotation( constraintAnnotationType );

    //the validator classes, e.g. [CheckCaseValidator.class]
    List<? extends AnnotationValue> validatorClassReferences = getValidatorClassesFromConstraintMetaAnnotation(
        constraintMetaAnnotation
    );
View Full Code Here

   */
  private AnnotationMirror getConstraintMetaAnnotation(DeclaredType annotationType) {

    List<? extends AnnotationMirror> annotationMirrors = annotationType.asElement().getAnnotationMirrors();

    AnnotationMirror constraintMetaAnnotation = annotationApiHelper.getMirror(
        annotationMirrors, Constraint.class
    );

    if ( constraintMetaAnnotation == null ) {
      throw new IllegalArgumentException( "Given type " + annotationType + " isn't a constraint annotation type." );
View Full Code Here

  }

  @Override
  public Set<ConstraintCheckError> checkAnnotationType(TypeElement element, AnnotationMirror annotation) {

    AnnotationMirror constraintMirror = annotationApiHelper.getMirror(
        element.getAnnotationMirrors(), Constraint.class
    );
    boolean atLeastOneValidatorGiven = !annotationApiHelper.getAnnotationArrayValue(
        constraintMirror, "validatedBy"
    ).isEmpty();
View Full Code Here

   */
  public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
    assert element != null;
    assert fqcn != null;

    AnnotationMirror mirror = null;
    for ( AnnotationMirror am : element.getAnnotationMirrors() ) {
      if ( isAnnotationMirrorOfType( am, fqcn ) ) {
        mirror = am;
        break;
      }
View Full Code Here

    List<? extends Element> myMembers = searchedElement.getEnclosedElements();
    for ( Element subElement : myMembers ) {
      List<? extends AnnotationMirror> entityAnnotations =
          context.getElementUtils().getAllAnnotationMirrors( subElement );
      for ( Object entityAnnotation : entityAnnotations ) {
        AnnotationMirror annotationMirror = (AnnotationMirror) entityAnnotation;
        if ( isIdAnnotation( annotationMirror ) ) {
          defaultAccessType = getAccessTypeOfIdAnnotation( subElement );
          break;
        }
      }
View Full Code Here

    return TypeUtils.isAnnotationMirrorOfType( annotationMirror, Id.class )
        || TypeUtils.isAnnotationMirrorOfType( annotationMirror, EmbeddedId.class );
  }

  public static AccessType determineAnnotationSpecifiedAccessType(Element element) {
    final AnnotationMirror accessAnnotationMirror = TypeUtils.getAnnotationMirror( element, Access.class );
    AccessType forcedAccessType = null;
    if ( accessAnnotationMirror != null ) {
      Element accessElement = (Element) TypeUtils.getAnnotationValue(
          accessAnnotationMirror,
          DEFAULT_ANNOTATION_PARAMETER_NAME
View Full Code Here

    log(annotations.toString());
    log(elements.toString());

    for (Element e : elements) {
      TypeElement providerImplementer = (TypeElement) e;
      AnnotationMirror providerAnnotation = getAnnotationMirror(e, ServiceProvider.class);
      DeclaredType providerInterface = getProviderInterface(providerAnnotation);
      TypeElement providerType = (TypeElement) providerInterface.asElement();

      log("provider interface: " + providerType.getQualifiedName());
      log("provider implementer: " + providerImplementer.getQualifiedName());
View Full Code Here

              valueConstraintValidatorMap);

          if (validator != null) {
            for (Element e : roundEnv
                .getElementsAnnotatedWith(annotationType)) {
              AnnotationMirror elementAnnotationMirror = AnnotationProcessingUtils
                  .findAnnotationMirror(processingEnv, e,
                      annotationType);
              Object actualValue = AnnotationProcessingUtils
                  .getAnnotationElementValue(
                      processingEnv,
View Full Code Here

  }

  private Class<?> getConstraintValidatorClass(
      TypeElement memberAnnotationTypeElement,
      Class<? extends Annotation> constraintAnnotationClass) {
    AnnotationMirror constraintAnnotation = AnnotationProcessingUtils
        .findAnnotationMirror(processingEnv,
            memberAnnotationTypeElement, constraintAnnotationClass);
    Class<?> constraintValidatorClass = null;

    if (constraintAnnotation != null) {
View Full Code Here

TOP

Related Classes of javax.lang.model.element.AnnotationMirror

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.