use of entity.Json2JavaElement in project CodeUtils by boredream.
the class SwaggerDocGenerator method parseJsonParams.
private static ArrayList<RequestParam> parseJsonParams(Element jsonElement) {
ArrayList<RequestParam> requestParams = new ArrayList<RequestParam>();
String jsonStr = jsonElement.getElementsByClass("json").text();
if (!jsonStr.isEmpty()) {
List<Json2JavaElement> jsonBeanTree = JsonUtils.getJsonBeanTree(jsonStr);
for (Json2JavaElement j2je : jsonBeanTree) {
String paramName = j2je.getName();
// 此类格式post参数没有描述
String paramDes = "";
Class<?> type = j2je.getType();
String pType = type == null ? "String" : j2je.getType().getSimpleName();
requestParams.add(new RequestParam(paramName, pType, paramDes, new ArrayList<String>()));
}
}
return requestParams;
}
Aggregations