Commit 33ac50cc authored by yanzg's avatar yanzg

删除处理

parent 3dbe6c70
......@@ -14,6 +14,7 @@ import java.util.regex.Pattern;
*/
public final class CheckerHelper {
public static final String PARAM_NOT_NULL_TIPS = "param [%s] is null";
public static final String PARAM_NOT_EMPTY_TIPS = "param [%s] is empty";
public static final String PARAM_NOT_NUMBER = "param [%s] must be number";
public static final String PARAM_OVER_MAX_LENGTH = "param [%s] maxlength is ";
......@@ -51,12 +52,30 @@ public final class CheckerHelper {
* @param paramVal
* @return
*/
public CheckerHelper notNull(String paramName, Object paramVal) {
if (!isValid()) {
return this;
}
if (paramVal == null) {
this.checkResult = String.format(PARAM_NOT_NULL_TIPS, paramName);
this.setValid(false);
}
return this;
}
/**
* 非空检查,包括空字符串
*
* @param paramName
* @param paramVal
* @return
*/
public CheckerHelper notBlankCheck(String paramName, Object paramVal) {
if (!isValid()) {
return this;
}
if (StringHelper.isEmpty(paramVal)) {
this.checkResult = String.format(PARAM_NOT_NULL_TIPS, paramName);
this.checkResult = String.format(PARAM_NOT_EMPTY_TIPS, paramName);
this.setValid(false);
}
return this;
......
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