Package javax.lang.model.util

Examples of javax.lang.model.util.Elements


      context.addMetaEntity( fqcn, metaEntity );
    }
  }

  private boolean xmlMappedTypeExists(String fullyQualifiedClassName) {
    Elements utils = context.getElementUtils();
    return utils.getTypeElement( fullyQualifiedClassName ) != null;
  }
View Full Code Here


    Elements utils = context.getElementUtils();
    return utils.getTypeElement( fullyQualifiedClassName ) != null;
  }

  private TypeElement getXmlMappedType(String fullyQualifiedClassName) {
    Elements utils = context.getElementUtils();
    return utils.getTypeElement( fullyQualifiedClassName );
  }
View Full Code Here

            }
        }

        // favor to use class javadoc of component as description
        if (model.getJavaType() != null) {
            Elements elementUtils = processingEnv.getElementUtils();
            TypeElement typeElement = findTypeElement(roundEnv, model.getJavaType());
            if (typeElement != null) {
                String doc = elementUtils.getDocComment(typeElement);
                if (doc != null) {
                    // need to sanitize the description first (we only want a summary)
                    doc = sanitizeDescription(doc, true);
                    // the javadoc may actually be empty, so only change the doc if we got something
                    if (!Strings.isNullOrEmpty(doc)) {
View Full Code Here

        return model;
    }

    protected void findClassProperties(RoundEnvironment roundEnv, Set<EndpointOption> endpointOptions, TypeElement classElement, String prefix) {
        Elements elementUtils = processingEnv.getElementUtils();
        while (true) {
            List<VariableElement> fieldElements = ElementFilter.fieldsIn(classElement.getEnclosedElements());
            if (fieldElements.isEmpty()) {
                break;
            }
            for (VariableElement fieldElement : fieldElements) {
                UriParam param = fieldElement.getAnnotation(UriParam.class);
                String fieldName = fieldElement.getSimpleName().toString();
                if (param != null) {
                    String name = param.name();
                    if (isNullOrEmpty(name)) {
                        name = fieldName;
                    }
                    name = prefix + name;

                    String defaultValue = param.defaultValue();
                    String defaultValueNote = param.defaultValueNote();

                    // if the field type is a nested parameter then iterate through its fields
                    TypeMirror fieldType = fieldElement.asType();
                    String fieldTypeName = fieldType.toString();
                    TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
                    UriParams fieldParams = null;
                    if (fieldTypeElement != null) {
                        fieldParams = fieldTypeElement.getAnnotation(UriParams.class);
                    }
                    if (fieldParams != null) {
                        String nestedPrefix = prefix;
                        String extraPrefix = fieldParams.prefix();
                        if (!isNullOrEmpty(extraPrefix)) {
                            nestedPrefix += extraPrefix;
                        }
                        findClassProperties(roundEnv, endpointOptions, fieldTypeElement, nestedPrefix);
                    } else {
                        String docComment = elementUtils.getDocComment(fieldElement);
                        if (isNullOrEmpty(docComment)) {
                            String setter = "set" + fieldName.substring(0, 1).toUpperCase();
                            if (fieldName.length() > 1) {
                                setter += fieldName.substring(1);
                            }
                            //  lets find the setter
                            List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());
                            for (ExecutableElement method : methods) {
                                String methodName = method.getSimpleName().toString();
                                if (setter.equals(methodName) && method.getParameters().size() == 1) {
                                    String doc = elementUtils.getDocComment(method);
                                    if (!isNullOrEmpty(doc)) {
                                        docComment = doc;
                                        break;
                                    }
                                }
View Full Code Here

        }
    }

    private Map<String, PropertyMirror> buildProperties() {
        Map<String, PropertyMirror> results = new LinkedHashMap<String, PropertyMirror>();
        Elements elementUtils = environment.getElementUtils();
        TypeElement element = (TypeElement) type.asElement();
        for (ExecutableElement method : ElementFilter.methodsIn(elementUtils.getAllMembers(element))) {
            PropertyMirror property = Util.toProperty(method);
            if (property != null) {
                results.put(property.getName(), property);
            }
        }
View Full Code Here

        }
    }

    private Map<String, PropertyMirror> buildProperties() {
        Map<String, PropertyMirror> results = new LinkedHashMap<String, PropertyMirror>();
        Elements elementUtils = environment.getElementUtils();
        for (TypeElement element : collectUpperBounds()) {
            for (ExecutableElement method : ElementFilter.methodsIn(elementUtils.getAllMembers(element))) {
                PropertyMirror property = Util.toProperty(method);
                if (property != null) {
                    results.put(property.getName(), property);
                }
            }
View Full Code Here

            writer.println("</table>");
        }
    }

    protected void findClassProperties(RoundEnvironment roundEnv, SortedMap<String, List<String>> sortedMap, TypeElement classElement, String prefix) {
        Elements elementUtils = processingEnv.getElementUtils();
        while (true) {
            List<VariableElement> fieldElements = ElementFilter.fieldsIn(classElement.getEnclosedElements());
            if (fieldElements.isEmpty()) {
                break;
            }
            for (VariableElement fieldElement : fieldElements) {
                UriParam param = fieldElement.getAnnotation(UriParam.class);
                String fieldName = fieldElement.getSimpleName().toString();
                if (param != null) {
                    String name = param.name();
                    if (Strings.isNullOrEmpty(name)) {
                        name = fieldName;
                    }
                    name = prefix + name;
                    // if the field type is a nested parameter then iterate through its fields
                    TypeMirror fieldType = fieldElement.asType();
                    String fieldTypeName = fieldType.toString();
                    TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
                    UriParams fieldParams = null;
                    if (fieldTypeElement != null) {
                        fieldParams = fieldTypeElement.getAnnotation(UriParams.class);
                    }
                    if (fieldParams != null) {
                        String nestedPrefix = prefix;
                        String extraPrefix = fieldParams.prefix();
                        if (!Strings.isNullOrEmpty(extraPrefix)) {
                            nestedPrefix += extraPrefix;
                        }
                        findClassProperties(roundEnv, sortedMap, fieldTypeElement, nestedPrefix);
                    } else {
                        String docComment = elementUtils.getDocComment(fieldElement);
                        if (Strings.isNullOrEmpty(docComment)) {
                            String setter = "set" + fieldName.substring(0, 1).toUpperCase();
                            if (fieldName.length() > 1) {
                                setter += fieldName.substring(1);
                            }
                            //  lets find the setter
                            List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());
                            for (ExecutableElement method : methods) {
                                String methodName = method.getSimpleName().toString();
                                if (setter.equals(methodName) && method.getParameters().size() == 1) {
                                    String doc = elementUtils.getDocComment(method);
                                    if (!Strings.isNullOrEmpty(doc)) {
                                        docComment = doc;
                                        break;
                                    }
                                }
View Full Code Here

      return resourceName.substring( resourceName.lastIndexOf( PATH_SEPARATOR ) + 1 );
    }
  }

  private boolean xmlMappedTypeExists(String fullyQualifiedClassName) {
    Elements utils = context.getProcessingEnvironment().getElementUtils();
    return utils.getTypeElement( fullyQualifiedClassName ) != null;
  }
View Full Code Here

    Elements utils = context.getProcessingEnvironment().getElementUtils();
    return utils.getTypeElement( fullyQualifiedClassName ) != null;
  }

  private TypeElement getXmlMappedType(String fullyQualifiedClassName) {
    Elements utils = context.getProcessingEnvironment().getElementUtils();
    return utils.getTypeElement( fullyQualifiedClassName );
  }
View Full Code Here

      return resourceName.substring( resourceName.lastIndexOf( Constants.PATH_SEPARATOR ) + 1 );
    }
  }

  private boolean xmlMappedTypeExists(String fullyQualifiedClassName) {
    Elements utils = context.getElementUtils();
    return utils.getTypeElement( fullyQualifiedClassName ) != null;
  }
View Full Code Here

TOP

Related Classes of javax.lang.model.util.Elements

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.