修复当返回值为Result<Void>时 程序异常停止bug

This commit is contained in:
xingzi 2019-11-25 13:27:06 +08:00
parent 9d2fc564db
commit f2c46d526a
2 changed files with 4 additions and 19 deletions

View File

@ -25,41 +25,24 @@ public class DocClassUtil {
type = type.toLowerCase();
switch (type) {
case "integer":
return true;
case "void":
case "int":
return true;
case "long":
return true;
case "double":
return true;
case "float":
return true;
case "short":
return true;
case "bigdecimal":
return true;
case "char":
return true;
case "string":
return true;
case "boolean":
return true;
case "byte":
return true;
case "java.sql.timestamp":
return true;
case "java.util.date":
return true;
case "java.time.localdatetime":
return true;
case "localdatetime":
return true;
case "localdate":
return true;
case "java.time.localdate":
return true;
case "java.math.bigdecimal":
return true;
case "java.math.biginteger":
return true;
default:

View File

@ -92,13 +92,15 @@ public class DocUtil {
* @return random value
*/
public static String jsonValueByType(String typeName) {
String type = typeName.contains(".") ? typeName.substring(typeName.lastIndexOf(".") + 1, typeName.length()) : typeName;
String type = typeName.contains(".") ? typeName.substring(typeName.lastIndexOf(".") + 1) : typeName;
String value = RandomUtil.randomValueByType(type);
if ("Integer".equals(type) || "int".equals(type) || "Long".equals(type) || "long".equals(type)
|| "Double".equals(type) || "double".equals(type) || "Float".equals(type) || "float".equals(type) ||
"BigDecimal".equals(type) || "boolean".equals(type) || "Boolean".equals(type) ||
"Short".equals(type) || "BigInteger".equals(type)) {
return value;
} else if("Void".equals(type)){
return "null";
} else {
StringBuilder builder = new StringBuilder();
builder.append("\"").append(value).append("\"");