Package javax.lang.model.element

Examples of javax.lang.model.element.TypeElement.asType()


    for (Element element : env.getElementsAnnotatedWith(Arg.class)) {
      TypeElement enclosingElement = (TypeElement) element.getEnclosingElement();

      // Check if its a fragment
      if (!((fragmentType != null && typeUtils.isSubtype(enclosingElement.asType(),
          fragmentType.asType())) || (supportFragmentType != null && typeUtils.isSubtype(
          enclosingElement.asType(), supportFragmentType.asType())))) {
        error(element, "@Arg can only be used on fragment fields (%s.%s)",
            enclosingElement.getQualifiedName(), element);
        continue;
View Full Code Here


      TypeElement enclosingElement = (TypeElement) element.getEnclosingElement();

      // Check if its a fragment
      if (!((fragmentType != null && typeUtils.isSubtype(enclosingElement.asType(),
          fragmentType.asType())) || (supportFragmentType != null && typeUtils.isSubtype(
          enclosingElement.asType(), supportFragmentType.asType())))) {
        error(element, "@Arg can only be used on fragment fields (%s.%s)",
            enclosingElement.getQualifiedName(), element);
        continue;
      }
View Full Code Here

    if (!method.getModifiers().contains(Modifier.STATIC)) {
      throw abortWithError("@AutoAnnotation method must be static", method);
    }

    TypeElement annotationElement = getAnnotationReturnType(method);
    TypeMirror annotationTypeMirror = annotationElement.asType();

    Set<Class<?>> wrapperTypesUsedInCollections = wrapperTypesUsedInCollections(method);

    ImmutableMap<String, ExecutableElement> memberMethods = getMemberMethods(annotationElement);
    Set<TypeMirror> memberTypes = getMemberTypes(memberMethods.values());
View Full Code Here

            return null;
        }

        TypeElement decoratorElement = (TypeElement) typeUtils.asElement( decoratorPrism.value() );

        if ( !typeUtils.isAssignable( decoratorElement.asType(), element.asType() ) ) {
            messager.printMessage(
                Kind.ERROR,
                String.format( "Specified decorator type is no subtype of the annotated mapper type." ),
                element,
                decoratorPrism.mirror
View Full Code Here

      assertEquals(expectedSimplifications, actualSimplifications);
    }

    public void testSimplifyMultipleBounds() {
      TypeElement multipleBoundsElement = typeElementOf("MultipleBounds");
      TypeMirror multipleBoundsMirror = multipleBoundsElement.asType();
      TypeSimplifier typeSimplifier = new TypeSimplifier(typeUtil, "",
          typeMirrorSet(multipleBoundsMirror), baseWithoutContainedTypes());
      assertEquals(ImmutableSet.of("java.util.List"), typeSimplifier.typesToImport());
      assertEquals("MultipleBounds<K, V>", typeSimplifier.simplify(multipleBoundsMirror));
      assertEquals("<K extends List<V> & Comparable<K>, V>",
View Full Code Here

        .addEquivalenceGroup(types.getNullType())
        .addEquivalenceGroup(types.getNoType(NONE))
        .addEquivalenceGroup(types.getNoType(VOID))
        .addEquivalenceGroup(objectType)
        .addEquivalenceGroup(stringType)
        .addEquivalenceGroup(funkyBounds.asType())
        // Enum<E extends Enum<E>>
        .addEquivalenceGroup(enumElement.asType())
        // Map<K, V>
        .addEquivalenceGroup(mapType)
        .addEquivalenceGroup(mapOfObjectToObjectType)
View Full Code Here

  public static TypeMirror getCollectionElementType(DeclaredType t, String fqNameOfReturnedType, String explicitTargetEntityName, Context context) {
    TypeMirror collectionElementType;
    if ( explicitTargetEntityName != null ) {
      Elements elements = context.getElementUtils();
      TypeElement element = elements.getTypeElement( explicitTargetEntityName );
      collectionElementType = element.asType();
    }
    else {
      List<? extends TypeMirror> typeArguments = t.getTypeArguments();
      if ( typeArguments.size() == 0 ) {
        throw new MetaModelGenerationException( "Unable to determine collection type" );
View Full Code Here

            TypeElement storeElement = (TypeElement) e;
            PackageElement packageElement = (PackageElement) storeElement.getEnclosingElement();

            final String packageName = packageElement.getQualifiedName().toString();
            final String storeDelegate = storeElement.getSimpleName().toString();
            final boolean changeSupport = typeUtils.isAssignable(storeElement.asType(),
                    elementUtils.getTypeElement(ChangeSupport.class.getName()).asType());
            final String storeClassName = GenerationUtil.storeImplementation(storeDelegate);
            messager.printMessage(NOTE,
                    String.format("Discovered annotated store [%s]", storeElement.getQualifiedName()));
View Full Code Here

        if (valueType == null) {
            valueType = defaultType;
        } else if (valueType.getParameters().isEmpty()) {
            TypeElement element = env.getElementUtils().getTypeElement(valueType.getFullName());
            if (element != null) {
                Type type = getType(element.asType(), deep);
                if (!type.getParameters().isEmpty()) {
                    valueType = new SimpleType(valueType, new Type[type.getParameters().size()]);
                }
            }
        }
View Full Code Here

        if (componentType == null) {
            componentType = defaultType;
        } else if (componentType.getParameters().isEmpty()) {
            TypeElement element = env.getElementUtils().getTypeElement(componentType.getFullName());
            if (element != null) {
                Type type = getType(element.asType(), deep);
                if (!type.getParameters().isEmpty()) {
                    componentType = new SimpleType(componentType, new Type[type.getParameters().size()]);
                }
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.