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 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 buildRequestBodies( ExecutableElement executableElement, RestDocumentation.Resource.Method doc) { List<VariableElement> requestBodies = new ArrayList<VariableElement>(); for (VariableElement var : executableElement.getParameters()) { if (var.getAnnotation(org.springframework.web.bind.annotation.RequestBody.class) != null) { requestBodies.add(var); } } if (requestBodies.size() > 1) { throw new IllegalStateException( String.format( "Method %s in class %s has multiple @RequestBody params", executableElement.getSimpleName(), executableElement.getEnclosingElement())); } if (requestBodies.size() == 1) { buildRequestBody(requestBodies.get(0), doc); } }