com.geese.plugin.excel.util.Assert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of easy-excel Show documentation
Show all versions of easy-excel Show documentation
像SQL一样操作Excel,简化Excel的读写操作
The newest version!
package com.geese.plugin.excel.util;
import java.util.Arrays;
import java.util.List;
/**
* 空值检查
*
* @author zhangguangyong [email protected]
* @date 2016/11/16 16:29
* @sine 0.0.1
*/
public final class Assert {
private Assert() {
}
public static void isTrue(boolean state) {
if (!state) {
throw new IllegalArgumentException();
}
}
public static void isTrue(boolean state, String errorMessage) {
if (!state) {
throw new IllegalArgumentException(errorMessage);
}
}
public static void isTrue(boolean state, String errorMessageTemplate, String... errorMessageArgs) {
if (!state) {
throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs));
}
}
public static T notNull(T reference) {
if (reference == null) {
throw new NullPointerException();
}
return reference;
}
public static T notNull(T reference, Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
return reference;
}
public static T notNull(
T reference, String errorMessageTemplate, Object... errorMessageArgs) {
if (reference == null) {
throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs));
}
return reference;
}
public static void notNull(Object first, Object second, Object... more) {
List