处理string为空
This commit is contained in:
parent
8c0685e5d2
commit
8b1a9c920f
@ -52,7 +52,7 @@ public class AnnotationUtil {
|
|||||||
checkTypes(checkNullAnnotation.name(), fieldValue.toString(), checkNullAnnotation.types());
|
checkTypes(checkNullAnnotation.name(), fieldValue.toString(), checkNullAnnotation.types());
|
||||||
} else if (field.isAnnotationPresent(CheckEmptyAnnotation.class)) {
|
} else if (field.isAnnotationPresent(CheckEmptyAnnotation.class)) {
|
||||||
CheckEmptyAnnotation checkEmptyAnnotation = field.getAnnotation(CheckEmptyAnnotation.class);
|
CheckEmptyAnnotation checkEmptyAnnotation = field.getAnnotation(CheckEmptyAnnotation.class);
|
||||||
if (StringUtils.isBlank(fieldValue.toString())) {
|
if (fieldValue == null || StringUtils.isBlank(fieldValue.toString())) {
|
||||||
throw new ParamsException(String.format("%s不能为空或空串", checkEmptyAnnotation.name()));
|
throw new ParamsException(String.format("%s不能为空或空串", checkEmptyAnnotation.name()));
|
||||||
}
|
}
|
||||||
checkRegular(checkEmptyAnnotation.name(), fieldValue.toString(), checkEmptyAnnotation.verifyType(), checkEmptyAnnotation.regex());
|
checkRegular(checkEmptyAnnotation.name(), fieldValue.toString(), checkEmptyAnnotation.verifyType(), checkEmptyAnnotation.regex());
|
||||||
|
Loading…
Reference in New Issue
Block a user