Package javax.lang.model.element

Examples of javax.lang.model.element.TypeElement


    if (state.types.isAssignable(returnType, state.requestContextType)) {
      Element returnTypeElement = state.types.asElement(returnType);
      if (!returnTypeElement.getKind().equals(ElementKind.INTERFACE)) {
        state.poison(x, Messages.factoryMustReturnInterface(returnTypeElement.getSimpleName()));
      } else {
        TypeElement contextElement = (TypeElement) returnTypeElement;
        state.maybeScanContext(contextElement);
        state.requireMapping(contextElement);
      }
    } else {
      state.poison(x, Messages.factoryMustBeAssignable(state.requestContextType.asElement()
View Full Code Here


        state.addMapping(x, (TypeElement) state.types.asElement(type));
      }
    }
    if (proxyForName != null) {
      poisonIfAnnotationPresent(state, x, jsonRpcProxy);
      TypeElement domain =
          state.elements.getTypeElement(BinaryName.toSourceName(proxyForName.value()));
      if (domain == null) {
        state.warn(x, Messages.proxyMissingDomainType(proxyForName.value()));
      }
      state.addMapping(x, domain);
View Full Code Here

            return false;
        }

        final Elements elements = javacProcessingEnv.getElementUtils();

        final TypeElement annotation = elements.getTypeElement(ANNOTATION_TYPE);

        if (annotation != null) {
            // Выбираем все элементы, у которых стоит наша аннотация
            final Set<? extends Element> methods = roundEnv.getElementsAnnotatedWith(annotation);
View Full Code Here

    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        if (annotations == null || annotations.isEmpty()) {
            return false;
        }

        final TypeElement annotation = javacProcessingEnv.getElementUtils().getTypeElement(ANNOTATION_TYPE);

        if (annotation != null) {
            final Set<? extends Element> classes = roundEnv.getElementsAnnotatedWith(annotation);
            JavacElements utils = javacProcessingEnv.getElementUtils();
View Full Code Here

    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        if (annotations == null || annotations.isEmpty()) {
            return false;
        }

        final TypeElement annotation = javacProcessingEnv.getElementUtils().getTypeElement(ANNOTATION_TYPE);

        if (annotation != null) {
            final Set<? extends Element> classes = roundEnv.getElementsAnnotatedWith(annotation);
            JavacElements utils = javacProcessingEnv.getElementUtils();
View Full Code Here

        return true;
    }

    private String generateObjectFactory(final Filer filer, final ExecutableElement constructorElement)
    {
        TypeElement classElement = (TypeElement) constructorElement.getEnclosingElement();
        String factoryName = classElement.getQualifiedName().toString() + "Factory";
        String factorySimpleName = classElement.getSimpleName().toString() + "Factory";
        String objectSimpleName = classElement.getSimpleName().toString();
        processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Generating factory file for " + classElement.getQualifiedName().toString());

        PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();

        try
        {
            JavaFileObject factoryFile = filer.createSourceFile(factoryName);
            PrintWriter pw = new PrintWriter(new OutputStreamWriter(factoryFile.openOutputStream(), "UTF-8"));
View Full Code Here

    @Override
    public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv)
    {

        Elements elementUtils = processingEnv.getElementUtils();
        TypeElement annotationElement = elementUtils.getTypeElement(MANAGED_OBJECT_CANONICAL_NAME);


        try
        {
View Full Code Here

    }

    private String getCategory(final TypeElement e)
    {
        Elements elementUtils = processingEnv.getElementUtils();
        TypeElement annotationElement = elementUtils.getTypeElement(MANAGED_OBJECT_CANONICAL_NAME);
        String category = null;
        List<? extends AnnotationMirror> annotationMirrors = e.getAnnotationMirrors();
        if(annotationMirrors != null)
        {
            for (AnnotationMirror a : annotationMirrors)
            {
                if (a.getAnnotationType().asElement().equals(annotationElement))
                {
                    category = e.getSimpleName().toString().toLowerCase();

                    for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : a.getElementValues()
                            .entrySet())
                    {
                        if (entry.getKey().getSimpleName().toString().equals("category"))
                        {
                            if (!Boolean.TRUE.equals(entry.getValue().getValue()))
                            {
                                category = null;
                            }

                            break;
                        }
                    }
                    break;
                }
            }
        }

        if (category == null)
        {
            for (TypeMirror interfaceMirror : e.getInterfaces())
            {
                category = getCategory((TypeElement) processingEnv.getTypeUtils().asElement(interfaceMirror));
                if (category != null)
                {
                    break;
                }
            }
        }

        if (category == null && e.getSuperclass() != null)
        {
            TypeElement parent = (TypeElement) processingEnv.getTypeUtils().asElement(e.getSuperclass());
            if(parent != null)
            {
                category = getCategory(parent);
            }
        }
View Full Code Here

    public void processAttributes(final RoundEnvironment roundEnv,
                                  String elementName)
    {

        Elements elementUtils = processingEnv.getElementUtils();
        TypeElement annotationElement = elementUtils.getTypeElement(elementName);

        for (Element e : roundEnv.getElementsAnnotatedWith(annotationElement))
        {
            checkAnnotationIsOnMethodInInterface(annotationElement, e);
View Full Code Here

    public void processStatistics(final RoundEnvironment roundEnv,
                                  String elementName)
    {

        Elements elementUtils = processingEnv.getElementUtils();
        TypeElement annotationElement = elementUtils.getTypeElement(elementName);

        for (Element e : roundEnv.getElementsAnnotatedWith(annotationElement))
        {
            checkAnnotationIsOnMethodInInterface(annotationElement, e);
View Full Code Here

TOP

Related Classes of javax.lang.model.element.TypeElement

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.