Package javax.lang.model.element

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


    private boolean validateClassModifiers(Element element) {
        assert element != null;
        TypeElement type = (TypeElement) element;
        DeclaredType superType = environment.getDeclaredType(FlowDescription.class);
        if (environment.getTypeUtils().isSubtype(type.asType(), superType) == false) {
            raiseInvalidClass(type, MessageFormat.format(
                    "フロー部品クラス{0}は{1}のサブクラスとして宣言する必要があります",
                    "{0}",
                    FlowDescription.class.getName()));
        }
View Full Code Here


        Precondition.checkMustNotBeNull(processor, "processor"); //$NON-NLS-1$
        Class<? extends Annotation> target = processor.getTargetAnnotationType();
        assert target != null;
        TypeElement annotation = environment.getElementUtils().getTypeElement(target.getCanonicalName());
        assert annotation != null;
        TypeMirror annotationType = annotation.asType();

        Set<? extends Element> elements = round.getElementsAnnotatedWith(annotation);
        for (Element element : elements) {
            ExecutableElement method = toOperatorMethodElement(element);
            if (method == null) {
View Full Code Here

     */
    protected TypeMirror getType(Class<?> klass, TypeMirror...arguments) {
        TypeElement type = elements.getTypeElement(klass.getName());
        assertThat(klass.getName(), type, not(nullValue()));
        if (arguments.length == 0) {
            return types.erasure(type.asType());
        } else {
            return types.getDeclaredType(type, arguments);
        }
    }
}
View Full Code Here

     */
    protected TypeMirror getType(Class<?> klass, TypeMirror...arguments) {
        TypeElement type = elements.getTypeElement(klass.getName());
        assertThat(klass.getName(), type, not(nullValue()));
        if (arguments.length == 0) {
            return types.erasure(type.asType());
        } else {
            return types.getDeclaredType(type, arguments);
        }
    }
}
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

                            if (topLevel.getKind() == Tree.Kind.CLASS) {
                                TypeElement type = (TypeElement) trees.getElement(TreePath.getPath(cu, topLevel));
                                if (type != null) {
                                    Set<Modifier> modifiers = type.getModifiers();
                                    if (modifiers.contains(Modifier.PUBLIC) &&
                                        ((applet != null && types.isSubtype(type.asType(), applet.asType()))
                                        || (japplet != null && types.isSubtype(type.asType(), japplet.asType())))) {
                                            result[0] = true;
                                            break;
                                    }
                                }
View Full Code Here

                                TypeElement type = (TypeElement) trees.getElement(TreePath.getPath(cu, topLevel));
                                if (type != null) {
                                    Set<Modifier> modifiers = type.getModifiers();
                                    if (modifiers.contains(Modifier.PUBLIC) &&
                                        ((applet != null && types.isSubtype(type.asType(), applet.asType()))
                                        || (japplet != null && types.isSubtype(type.asType(), japplet.asType())))) {
                                            result[0] = true;
                                            break;
                                    }
                                }
                            }
View Full Code Here

        Types typeUtils = processingEnv.getTypeUtils();
        TypeMirror configuredObjectType = getErasure("org.apache.qpid.server.model.ConfiguredObject");
        TypeElement parent = (TypeElement) e.getEnclosingElement();


        if (!typeUtils.isAssignable(typeUtils.erasure(parent.asType()), configuredObjectType))
        {
            processingEnv.getMessager()
                    .printMessage(Diagnostic.Kind.ERROR,
                                  "@"
                                  + annotationElement.getSimpleName()
View Full Code Here

                                  "@"
                                  + annotationElement.getSimpleName()
                                  + " can only be applied to methods within an interface which extends "
                                  + configuredObjectType.toString()
                                  + " which does not apply to "
                                  + parent.asType().toString(),
                                  e);
        }
    }

    public void checkAnnotationIsOnMethodInInterface(final TypeElement annotationElement, final Element e)
View Full Code Here

        TypeElement annotationElement = elementUtils.getTypeElement(MANAGED_ATTRIBUTE_FIELD_CLASS_NAME);
        for (Element e : roundEnv.getElementsAnnotatedWith(annotationElement))
        {
            for(AnnotationMirror am : e.getAnnotationMirrors())
            {
                if(typeUtils.isSameType(am.getAnnotationType(), annotationElement.asType()))
                {
                    for(Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : am.getElementValues().entrySet())
                    {
                        String elementName = entry.getKey().getSimpleName().toString();
                        if(elementName.equals("beforeSet") || elementName.equals("afterSet"))
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.