This commit is contained in:
@@ -107,8 +107,7 @@ public class RestDocs extends HttpBaseServlet {
|
||||
|
||||
typesmap.put(ptype.getName(), typemap);
|
||||
}
|
||||
actionmap.put("result", action.result().getName());
|
||||
actionmap.put("ret", action.ret());
|
||||
actionmap.put("result", action.result());
|
||||
actionsList.add(actionmap);
|
||||
}
|
||||
actionsList.sort((o1, o2) -> ((String) o1.get("url")).compareTo((String) o2.get("url")));
|
||||
|
||||
@@ -55,8 +55,7 @@
|
||||
}
|
||||
paramshtml.push('</table>');
|
||||
html.push('<td class="s" style="padding:0 5px;">' + paramshtml.join('') + '</td>');
|
||||
var rt = action.result.substring(action.result.lastIndexOf('.') + 1);
|
||||
html.push('<td>' + (action.ret ? ("RetResult<" + rt + ">") : rt) + '</td>');
|
||||
html.push('<td>' + action.result.replace(/</g,"<").replace(/>/g,">").replace(/([a-zA-Z0-9_\$]+\.)+/g, "") + '</td>');
|
||||
html.push('</tr>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,9 +114,8 @@ public abstract class HttpBaseServlet extends HttpServlet {
|
||||
|
||||
WebParam[] params() default {};
|
||||
|
||||
Class result() default Object.class; //输出结果的数据类型
|
||||
String result() default "Object"; //输出结果的数据类型
|
||||
|
||||
boolean ret() default true; //是否为RetResult包装
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -339,22 +339,15 @@ public final class Rest {
|
||||
}
|
||||
av3.visitEnd();
|
||||
}
|
||||
boolean ret = returnType == RetResult.class;
|
||||
java.lang.reflect.Type rt = method.getGenericReturnType();
|
||||
boolean subrt = (ret && rt instanceof ParameterizedType);
|
||||
java.lang.reflect.Type[] subts = subrt ? ((ParameterizedType) rt).getActualTypeArguments() : null;
|
||||
Class cz = subts == null ? returnType
|
||||
: (subts[0] instanceof Class ? (Class) subts[0] : (subts[0] instanceof ParameterizedType ? (Class) ((ParameterizedType) subts[0]).getRawType() : Object.class));
|
||||
av0.visit("result", Type.getType(Type.getDescriptor(subrt ? cz : returnType)));
|
||||
av0.visit("ret", ret);
|
||||
java.lang.reflect.Type grt = method.getGenericReturnType();
|
||||
av0.visit("result", grt == returnType ? returnType.getName(): String.valueOf(grt));
|
||||
|
||||
av0.visitEnd();
|
||||
actionMap.put("url", url);
|
||||
actionMap.put("actionid", entry.actionid);
|
||||
actionMap.put("comment", entry.comment);
|
||||
actionMap.put("methods", entry.methods);
|
||||
actionMap.put("result", subrt ? cz.getName() : returnType.getName());
|
||||
actionMap.put("ret", ret);
|
||||
actionMap.put("result", grt == returnType ? returnType.getName(): String.valueOf(grt));
|
||||
}
|
||||
|
||||
List<Map<String, Object>> paramMaps = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user