private void scanForMultipart( ExecutableElement executableElement, RestDocumentation.Resource.Method doc) { for (VariableElement var : executableElement.getParameters()) { TypeMirror varType = var.asType(); if (varType.toString().startsWith(MultipartHttpServletRequest.class.getName())) { doc.setMultipartRequest(true); return; } } }
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); }
private void buildUrlParameters( ExecutableElement executableElement, RestDocumentation.Resource.Method doc) { RestDocumentation.Resource.Method.UrlFields subs = doc.getUrlParameters(); for (VariableElement var : executableElement.getParameters()) { RequestParam reqParam = var.getAnnotation(RequestParam.class); if (reqParam != null) { addUrlField(subs, var, reqParam.value()); } } }
private void buildPathVariables( ExecutableElement executableElement, RestDocumentation.Resource.Method doc) { RestDocumentation.Resource.Method.UrlFields subs = doc.getUrlSubstitutions(); for (VariableElement var : executableElement.getParameters()) { PathVariable pathVar = var.getAnnotation(PathVariable.class); if (pathVar != null) { addUrlField(subs, var, pathVar.value()); } } }
private void buildResponseFormat(TypeMirror type, RestDocumentation.Resource.Method doc) { doc.setResponseBody(newJsonType(type)); }
private void buildRequestBody(VariableElement var, RestDocumentation.Resource.Method doc) { doc.setRequestBody(newJsonType(var.asType())); }