
com.huaweicloud.dws.client.util.AssertUtil Maven / Gradle / Ivy
package com.huaweicloud.dws.client.util;
import java.util.Collection;
import java.util.Objects;
/**
* @ProjectName: dws-connector
* @ClassName: AssertUtil
* @Description:
* @Date: 2022/12/23 11:47
* @Version: 1.0
*/
public class AssertUtil {
public static void nonNull(Object obj, T e) throws T {
if (Objects.isNull(obj)) {
throw e;
}
}
public static void isNull(Object obj, T e) throws T {
if (Objects.nonNull(obj)) {
throw e;
}
}
public static void notEmpty(Collection> obj, T e) throws T {
isTrue(!(Objects.isNull(obj) || obj.isEmpty()), e);
}
public static void isTrue(boolean ex, T e) throws T {
if (!ex) {
throw e;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy