Example #1
0
  private void processRequestMappingMethod(ExecutableElement executableElement) {
    TypeElement cls = (TypeElement) executableElement.getEnclosingElement();
    String path = getClassLevelUrlPath(cls);

    RequestMapping anno = executableElement.getAnnotation(RequestMapping.class);
    path = addMethodPathComponent(executableElement, cls, path, anno);
    RequestMethod meth = getRequestMethod(executableElement, cls, anno);

    RestDocumentation.Resource.Method doc =
        _docs.getResourceDocumentation(path).newMethodDocumentation(meth);
    String docComment = processingEnv.getElementUtils().getDocComment(executableElement);
    if (StringUtils.isNotBlank(docComment)) {
      MethodStructure methodStructure = generateMethodStructure(docComment);
      doc.setCommentText(generateJavaDocHTML(methodStructure));
      doc.setCommentSummary(methodStructure.getDescription());
    }
    buildParameterData(executableElement, doc);
    buildResponseFormat(executableElement.getReturnType(), doc);
  }
Example #2
0
    private boolean isJsonBeanGetter(ExecutableElement executableElement) {
      if (executableElement.getKind() != ElementKind.METHOD) {
        return false;
      }

      if (executableElement.getReturnType().getKind() == TypeKind.NULL) {
        return false;
      }

      if (!(executableElement.getSimpleName().toString().startsWith("get")
          || executableElement.getSimpleName().toString().startsWith("is"))) {
        return false;
      }

      if (executableElement.getParameters().size() > 0) {
        return false;
      }

      return executableElement.getAnnotation(JsonIgnore.class) == null;
    }