Package javax.lang.model.type

Examples of javax.lang.model.type.DeclaredType


        return propertyNames;
    }

    private static String getQualifiedName(TypeMirror type) {
        DeclaredType declaredType = type.accept(
            new SimpleTypeVisitor6<DeclaredType, Void>() {
                @Override
                public DeclaredType visitDeclared(DeclaredType t, Void p) {
                    return t;
                }
            },
            null
        );

        if ( declaredType == null ) {
            return null;
        }

        TypeElement typeElement = declaredType.asElement().accept(
            new SimpleElementVisitor6<TypeElement, Void>() {
                @Override
                public TypeElement visitType(TypeElement e, Void p) {
                    return e;
                }
View Full Code Here


    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());

      if (!checkImplementer(providerImplementer, providerType)) {
View Full Code Here

      assertEquals("one", one.getSimpleName().toString());
      assertEquals("two", two.getSimpleName().toString());
      TypeMirrorSet typeMirrorSet = new TypeMirrorSet();
      assertTrue(typeMirrorSet.add(one.getReturnType()));
      assertFalse(typeMirrorSet.add(two.getReturnType()));
      DeclaredType captureOne = (DeclaredType) typeUtil.capture(one.getReturnType());
      assertTrue(typeMirrorSet.add(captureOne));
      DeclaredType captureTwo = (DeclaredType) typeUtil.capture(two.getReturnType());
      assertFalse(typeMirrorSet.add(captureTwo));
      // Reminder: captureOne is Map<?#123 extends T, ?#456 super U>
      TypeVariable extendsT = (TypeVariable) captureOne.getTypeArguments().get(0);
      assertTrue(typeMirrorSet.add(extendsT));
      assertTrue(typeMirrorSet.add(extendsT.getLowerBound()))// NoType
View Full Code Here

  }

  static Parameter forVariableElement(VariableElement variable, TypeMirror type) {
    ImmutableSet.Builder<String> qualifiers = ImmutableSet.builder();
    for (AnnotationMirror annotationMirror : variable.getAnnotationMirrors()) {
      DeclaredType annotationType = annotationMirror.getAnnotationType();
      if (annotationType.asElement().getAnnotation(Qualifier.class) != null) {
        qualifiers.add(Mirrors.getQualifiedName(annotationType).toString());
      }
    }
    // TODO(gak): check for only one qualifier rather than using the first
    return new Parameter(FluentIterable.from(qualifiers.build()).first(),
View Full Code Here

    TypeMirror stringType = elements.getTypeElement(String.class.getCanonicalName()).asType();
    TypeElement mapElement = elements.getTypeElement(Map.class.getCanonicalName());
    TypeElement setElement = elements.getTypeElement(Set.class.getCanonicalName());
    TypeElement enumElement = elements.getTypeElement(Enum.class.getCanonicalName());
    TypeElement funkyBounds = elements.getTypeElement(FunkyBounds.class.getCanonicalName());
    DeclaredType mapOfObjectToObjectType =
        types.getDeclaredType(mapElement, objectType, objectType);
    TypeMirror mapType = mapElement.asType();
    WildcardType wildcard = types.getWildcardType(null, null);
    EquivalenceTester<TypeMirror> tester = EquivalenceTester.<TypeMirror>of(MoreTypes.equivalence())
        .addEquivalenceGroup(types.getNullType())
View Full Code Here

                    if (!method.getModifiers().contains(Modifier.PUBLIC))
                        continue; // let's validate only public methods
                    if (!isLegalMethod(method, element))
                        return false;
                }
                DeclaredType superClass = (DeclaredType) element.getSuperclass();

                TypeElement tE = (TypeElement) superClass.asElement();
                return tE.getQualifiedName().toString().equals(Object.class.getName())
                        || methodsAreLegal(tE);
            }
            default: {
                throw new IllegalArgumentException("Class or interface was expecting. But element: " + element);
View Full Code Here

      if ( !propertyName.equals( elementPropertyName ) ) {
        continue;
      }

      DeclaredType type = determineDeclaredType( elem );
      if ( type == null ) {
        continue;
      }

      return determineTypes( propertyName, explicitTargetEntity, explicitMapKeyClass, type );
View Full Code Here

    }
    return null;
  }

  private DeclaredType determineDeclaredType(Element elem) {
    DeclaredType type = null;
    if ( elem.asType() instanceof DeclaredType ) {
      type = ( (DeclaredType) elem.asType() );
    }
    else if ( elem.asType() instanceof ExecutableType ) {
      ExecutableType executableType = (ExecutableType) elem.asType();
View Full Code Here

        Set<TypeElement> elements = new HashSet<TypeElement>();
        for (Map.Entry<? extends ExecutableElement,? extends AnnotationValue> entry : mirror.getElementValues().entrySet()) {
            if (entry.getKey().getSimpleName().toString().equals(method)) {
                List<AnnotationValue> values = ((List) entry.getValue().getValue());
                for (AnnotationValue value : values) {
                    DeclaredType type = (DeclaredType) value.getValue();
                    elements.add((TypeElement) type.asElement());
                }
            }
        }
        return elements;
    }
View Full Code Here

      if ( !propertyName.equals( elementPropertyName ) ) {
        continue;
      }

      DeclaredType type = determineDeclaredType( elem );
      if ( type == null ) {
        continue;
      }

      return determineTypes( propertyName, explicitTargetEntity, explicitMapKeyClass, type );
View Full Code Here

TOP

Related Classes of javax.lang.model.type.DeclaredType

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.