private RequestMethod getRequestMethod( ExecutableElement executableElement, TypeElement cls, RequestMapping anno) { if (anno.method().length != 1) { throw new IllegalStateException( String.format( "The RequestMapping annotation for %s.%s is not parseable. Exactly one request method (GET/POST/etc) is required.", cls.getQualifiedName(), executableElement.getSimpleName())); } else { return anno.method()[0]; } }
private String getClassLevelUrlPath(TypeElement cls) { RestApiMountPoint mountPoint = cls.getAnnotation(RestApiMountPoint.class); String path = mountPoint == null ? "/" : mountPoint.value(); RequestMapping clsAnno = cls.getAnnotation(RequestMapping.class); if (clsAnno == null || clsAnno.value().length == 0) { return path; } else if (clsAnno.value().length == 1) { return Utils.joinPaths(path, clsAnno.value()[0]); } else { throw new IllegalStateException( String.format( "The RequestMapping annotation of class %s has multiple value strings. Only zero or one value is supported", cls.getQualifiedName())); } }
private void buildTypeContents(JsonObject o, TypeElement element) { if ("org.springframework.web.servlet.ModelAndView" .equals(element.getQualifiedName().toString())) { return; } if (element.getSuperclass().getKind() != TypeKind.NONE) { // an interface's superclass is TypeKind.NONE DeclaredType sup = (DeclaredType) element.getSuperclass(); if (!isJsonPrimitive(sup)) { buildTypeContents(o, (TypeElement) sup.asElement()); } } for (Element e : element.getEnclosedElements()) { if (e instanceof ExecutableElement) { addFieldFromBeanMethod(o, (ExecutableElement) e); } } }