This commit is contained in:
Redkale
2016-09-13 16:07:26 +08:00
parent 95f4cd0634
commit 4e9b3f45fc

View File

@@ -92,7 +92,7 @@ public class RestDocs extends HttpBaseServlet {
if (Modifier.isStatic(field.getModifiers())) continue; if (Modifier.isStatic(field.getModifiers())) continue;
Map<String, String> fieldmap = new LinkedHashMap<>(); Map<String, String> fieldmap = new LinkedHashMap<>();
fieldmap.put("type", field.getType().getName()); fieldmap.put("type", field.getType().isArray() ? (field.getType().getComponentType().getName()+"[]") : field.getType().getName());
Comment comment = field.getAnnotation(Comment.class); Comment comment = field.getAnnotation(Comment.class);
if (comment != null) fieldmap.put("comment", comment.value()); if (comment != null) fieldmap.put("comment", comment.value());
@@ -130,7 +130,7 @@ public class RestDocs extends HttpBaseServlet {
if (doctemplate.isFile() && doctemplate.canRead()) { if (doctemplate.isFile() && doctemplate.canRead()) {
in = new FileInputStream(doctemplate); in = new FileInputStream(doctemplate);
} }
if(in == null) in = RestDocs.class.getResourceAsStream("restdoc-template.html"); if (in == null) in = RestDocs.class.getResourceAsStream("restdoc-template.html");
String content = Utility.read(in).replace("${content}", json); String content = Utility.read(in).replace("${content}", json);
in.close(); in.close();
FileOutputStream outhtml = new FileOutputStream(new File(app.getHome(), "restdoc.html")); FileOutputStream outhtml = new FileOutputStream(new File(app.getHome(), "restdoc.html"));