package com.philisense.www.utils;

import com.philisense.www.core.text.Convert;
import com.philisense.www.exception.UtilsException;
import org.springframework.util.Assert;

import java.util.Objects;

/**
 * 断言
 *
 * @date 2021-03-04
 */
public class AssertUtils extends Assert {

    public static void isNull(Object var, String message) {
        if (Objects.isNull(var)) {
            throw new UtilsException(message);
        }
        if (var instanceof String) {
            if(StringUtils.isEmpty(Convert.toStr(var))) {
                throw new UtilsException(message);
            }
        }
    }

}
