Commit 8451c5a0 by 刘宇峰

框架完善

1 parent 2f228f9f
package com.glsx.plat.context.utils;
import cn.hutool.core.lang.Assert;
import com.glsx.plat.exception.ValidateException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.text.MessageFormat;
import java.util.Objects;
/**
* 断言工具类
*/
public class AssertUtils {
public class AssertUtils extends Assert {
public static void isBlank(String str, String message) {
public static void isBlank(String str, String message, Object... params) {
if (StringUtils.isBlank(str)) {
throw new ValidateException(message);
throw new ValidateException(MessageFormat.format(message, params));
}
}
public static void isNull(Object object, String message) {
public static void isNull(Object object, String message, Object... params) {
if (Objects.isNull(object)) {
throw new ValidateException(message);
throw new ValidateException(MessageFormat.format(message, params));
}
}
public static void isEmpty(Object object, String message) {
public static void isEmpty(Object object, String message, Object... params) {
if (CollectionUtils.sizeIsEmpty(object)) {
throw new ValidateException(message);
throw new ValidateException(MessageFormat.format(message, params));
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!