Commit 063f14ac by s_guodong

增加int长度的校验

parent 8805e1b4
......@@ -65,6 +65,12 @@ public class ValidatorUtil {
}
}
} else if (type.isAssignableFrom(Integer.TYPE) || type.isAssignableFrom(Integer.class)) {
int min = length.min();
String stringValue = String.valueOf(o);
if (stringValue.length() > max || stringValue.length() < min) {
return "参数校验错误[" + message + "]";
}
}
}
......@@ -123,7 +129,7 @@ public class ValidatorUtil {
}
}
}
if (f.isAnnotationPresent(ListValue.class) && o != null && StringUtils.isNotBlank(((String) o).trim())) {
if (f.isAnnotationPresent(ListValue.class) && o != null && StringUtils.isNotBlank((String.valueOf(o)).trim())) {
ListValue annotation = f.getAnnotation(ListValue.class);
int index = -1;
if (type.isAssignableFrom(String.class)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment