Package javax.lang.model.element

Examples of javax.lang.model.element.AnnotationMirror


    log(elements.toString());

    for (Element e : elements) {
      // TODO(gak): check for error trees?
      TypeElement providerImplementer = (TypeElement) e;
      AnnotationMirror providerAnnotation = getAnnotationMirror(e, AutoService.class).get();
      DeclaredType providerInterface = getProviderInterface(providerAnnotation);
      TypeElement providerType = (TypeElement) providerInterface.asElement();

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


      this.messager = messager;
    }

    Optional<AutoFactoryDeclaration> createIfValid(Element element) {
      checkNotNull(element);
      AnnotationMirror mirror = Mirrors.getAnnotationMirror(element, AutoFactory.class).get();
      checkArgument(Mirrors.getQualifiedName(mirror.getAnnotationType()).
          contentEquals(AutoFactory.class.getName()));
      Map<String, AnnotationValue> values =
          Mirrors.simplifyAnnotationValueMap(elements.getElementValuesWithDefaults(mirror));
      checkState(values.size() == 3);
View Full Code Here

    this.elements = elements;
    this.declarationFactory = declarationFactory;
  }

  ImmutableSet<FactoryMethodDescriptor> generateDescriptor(Element element) {
    final AnnotationMirror mirror = Mirrors.getAnnotationMirror(element, AutoFactory.class).get();
    final Optional<AutoFactoryDeclaration> declaration = declarationFactory.createIfValid(element);
    if (!declaration.isPresent()) {
      return ImmutableSet.of();
    }
    return element.accept(new ElementKindVisitor6<ImmutableSet<FactoryMethodDescriptor>, Void>() {
View Full Code Here

    Map<String, List<String>> serviceProviders = new HashMap<String, List<String>>();

    for (Element e : roundEnv
        .getElementsAnnotatedWith(ServiceProvider.class)) {
      TypeElement typeElement = (TypeElement) e;
      AnnotationMirror annotation = AnnotationProcessingUtils
          .findAnnotationMirror(processingEnv, typeElement,
              ServiceProvider.class);

      if (annotation == null) {
        // Workaround a strange bug...
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 ) ) {
          return getAccessTypeOfIdAnnotation( subElement );
        }
      }
    }
View Full Code Here

    return TypeUtils.isAnnotationMirrorOfType( annotationMirror, Constants.ID )
        || TypeUtils.isAnnotationMirrorOfType( annotationMirror, Constants.EMBEDDED_ID );
  }

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

        if (((ExecutableElement) target).getReturnType().getKind() != TypeKind.VOID) {
          processingEnv.getMessager().printMessage(
                  Kind.ERROR, "@EventHandler methods must return void", target);
        }
       
        AnnotationMirror eventHandlerAnnotation = getAnnotation(target, TypeNames.EVENT_HANDLER);
        TypeElement enclosingClassElement = (TypeElement) target.getEnclosingElement();
        boolean hasSinkNative = hasAnnotation(target, TypeNames.SINK_NATIVE);
       
        AnnotationValue eventHandlerAnnotationValue = getAnnotationParamValueWithoutDefaults(target, TypeNames.EVENT_HANDLER, "value");
       
View Full Code Here

   * @return the String value of the given annotation's parameter, or null if
   *         the parameter is not present on the annotation.
   */
  static AnnotationValue getAnnotationParamValueWithoutDefaults(
          Element target, CharSequence annotationQualifiedName, CharSequence paramName) {
    AnnotationMirror templatedAnnotation = getAnnotation(target, annotationQualifiedName);
    Map<? extends ExecutableElement, ? extends AnnotationValue> annotationParams = templatedAnnotation.getElementValues();
    for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> param : annotationParams.entrySet()) {
      if (param.getKey().getSimpleName().contentEquals(paramName)) {
        return param.getValue();
      }
    }
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

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.