Package javax.lang.model.type

Examples of javax.lang.model.type.DeclaredType.asElement()


        Types tu = env.getTypeUtils();
        t = tu.erasure(t);
        if (t.getKind().equals(TypeKind.DECLARED)) {
            DeclaredType dt = (DeclaredType)t;
            if (!dt.getTypeArguments().isEmpty())
                return tu.getDeclaredType((TypeElement) dt.asElement());
        }
        return t;
    }

    public boolean isAbstract(TypeElement clazz) {
View Full Code Here


    AnnotationValue scopeValue = AnnotationProcessingUtils
        .getAnnotationElementValue(procEnv, annotation, "scope");

    DeclaredType referencedAnnotationClass = (DeclaredType) referencedAnnotationClassValue
        .getValue();
    TypeElement referencedAnnotationTypeElement = (TypeElement) referencedAnnotationClass
        .asElement();
    ConstraintScope scope = ConstraintScope.valueOf(scopeValue.getValue()
        .toString());
    Boolean nullable = Boolean.valueOf(nullableValue.getValue().toString());
    Map<Element, Set<Element>> elements = new HashMap<Element, Set<Element>>();
View Full Code Here

        Attribute.Compound anno = cast(Attribute.Compound.class, a);
        DeclaredType annotype = a.getAnnotationType();
        Map<MethodSymbol, Attribute> valmap = anno.getElementValues();

        for (ExecutableElement ex :
                 methodsIn(annotype.asElement().getEnclosedElements())) {
            MethodSymbol meth = (MethodSymbol) ex;
            Attribute defaultValue = meth.getDefaultValue();
            if (defaultValue != null && !valmap.containsKey(meth)) {
                valmap.put(meth, defaultValue);
            }
View Full Code Here

      return CollectionHelper.asSet(
          new ConstraintCheckError( groupsMethod, null, "RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    boolean typeHasNameClass = type.asElement().getSimpleName().contentEquals( "Class" );
    boolean typeHasExactlyOneTypeArgument = type.getTypeArguments().size() == 1;
    boolean typeArgumentIsUnboundWildcard = validateWildcardBounds( type.getTypeArguments().get( 0 ), null, null );

    if ( !( typeHasNameClass && typeHasExactlyOneTypeArgument && typeArgumentIsUnboundWildcard ) ) {
      return CollectionHelper.asSet(
View Full Code Here

      return CollectionHelper.asSet(
          new ConstraintCheckError( payloadMethod, null, "PAYLOAD_RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    boolean typeHasNameClass = type.asElement().getSimpleName().contentEquals( "Class" );
    boolean typeHasExactlyOneTypeArgument = type.getTypeArguments().size() == 1;
    boolean typeArgumentIsWildcardWithPayloadExtendsBound = validateWildcardBounds(
        type.getTypeArguments().get( 0 ), annotationApiHelper.getMirrorForType( Payload.class ), null
    );
View Full Code Here

        Attribute.Compound anno = cast(Attribute.Compound.class, a);
        DeclaredType annotype = a.getAnnotationType();
        Map<MethodSymbol, Attribute> valmap = anno.getElementValues();

        for (ExecutableElement ex :
                 methodsIn(annotype.asElement().getEnclosedElements())) {
            MethodSymbol meth = (MethodSymbol) ex;
            Attribute defaultValue = meth.getDefaultValue();
            if (defaultValue != null && !valmap.containsKey(meth)) {
                valmap.put(meth, defaultValue);
            }
View Full Code Here

        void test(TypeElement element, boolean fbound) {
            TypeParameterElement tpe = element.getTypeParameters().iterator().next();
            tpe.getBounds().getClass();
            if (fbound) {
                DeclaredType type = (DeclaredType)tpe.getBounds().get(0);
                if (type.asElement() != element)
                    throw error("%s != %s", type.asElement(), element);
                TypeVariable tv = (TypeVariable)type.getTypeArguments().get(0);
                if (tv.asElement() != tpe)
                    throw error("%s != %s", tv.asElement(), tpe);
            }
View Full Code Here

            TypeParameterElement tpe = element.getTypeParameters().iterator().next();
            tpe.getBounds().getClass();
            if (fbound) {
                DeclaredType type = (DeclaredType)tpe.getBounds().get(0);
                if (type.asElement() != element)
                    throw error("%s != %s", type.asElement(), element);
                TypeVariable tv = (TypeVariable)type.getTypeArguments().get(0);
                if (tv.asElement() != tpe)
                    throw error("%s != %s", tv.asElement(), tpe);
            }
        }
View Full Code Here

        }
    }

    void testParseType(TypeElement clazz) {
        DeclaredType type = (DeclaredType)task.parseType("List<String>", clazz);
        for (Element member : elements.getAllMembers((TypeElement)type.asElement())) {
            TypeMirror mt = types.asMemberOf(type, member);
            System.out.format("%s : %s -> %s%n", member.getSimpleName(), member.asType(), mt);
        }
    }
View Full Code Here

        String qualifiedName;

        DeclaredType declaredType = mirror.getKind() == TypeKind.DECLARED ? (DeclaredType) mirror : null;

        if ( declaredType != null ) {
            isEnumType = declaredType.asElement().getKind() == ElementKind.ENUM;
            isInterface = declaredType.asElement().getKind() == ElementKind.INTERFACE;
            name = declaredType.asElement().getSimpleName().toString();

            typeElement = declaredType.asElement().accept( new TypeElementRetrievalVisitor(), null );
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.