package com.ydtech.modules.protocol.utils; import com.ydtech.exception.SystemException; import org.apache.commons.lang3.StringUtils; import org.springframework.util.ObjectUtils; /** * 断言工具类 * * @author wenks */ public class AssertionUtils { private AssertionUtils() { throw new IllegalStateException("AssertionUtils class"); } private static void assertion(boolean b, String message) { if (b) throw new SystemException(message); } public static void isSucceed(int b, String message) { assertion(b <= 0, message); } public static void isSucceed(boolean b, String message) { assertion(!b, message); } public static void isEmpty(Object o, String message) { assertion(ObjectUtils.isEmpty(o), message); } public static void isStringEmpty(String s, String message) { assertion(StringUtils.isEmpty(s), message); } }