package cn.autoform.util; import cn.autoform.fw.exception.IEMRuntimeException; import cn.autoform.util.tool.ObjectUtil; /** * 鏂█绫� * @author WangYX * */ public class Assert { /** * 楠岃瘉瀵硅薄鏄惁涓篘ULL,绌哄瓧绗︿覆锛岀┖鏁扮粍锛岀┖鐨凜ollection鎴朚ap(鍙湁绌烘牸鐨勫瓧绗︿覆涔熻涓烘槸绌轰覆) * @Title: empty * @param @param obj * @param @param code * @param @param args 璁惧畾鏂囦欢 * @return void 杩斿洖绫诲瀷 * @throws */ public static void empty(Object obj, String code, String... args) { empty(obj, new IEMRuntimeException(code, args)); } /** * 涓虹┖鎶涘嚭寮傚父 * @param obj * @param re */ public static void empty(Object obj, RuntimeException re){ if (ObjectUtil.empty(obj)) throw re; } /** * 鏍规嵁鏉′欢鎶涘嚭寮傚父 * @param cond * @param re */ public static void condition(Boolean cond, RuntimeException re){ if(cond != null && cond){ throw re; } } /** * 鏍规嵁鏉′欢鎶涘嚭寮傚父 * @param cond * @param re */ public static void condition(Boolean cond, String code, String... args){ if(cond != null && cond){ condition(cond, new IEMRuntimeException(code, args)); } } }