com.aluka.nirvana.framework.exception.utils.ArgumentUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nirvana-exception Show documentation
Show all versions of nirvana-exception Show documentation
Exception configuration of Nirvana Projects.
The newest version!
package com.aluka.nirvana.framework.exception.utils;
import com.aluka.nirvana.framework.exception.assortment.ArgumentException;
import com.aluka.nirvana.framework.exception.constant.ArgumentErrors;
/**
* 校验参数基本工具
* @author gongli
* @since 2019/12/25
*/
public class ArgumentUtil {
private ArgumentUtil() {
}
public static void checkArgument(boolean expression, String message) {
if (!expression) {
ArgumentException e = new ArgumentException(ArgumentErrors.ARGUMENT_ERROR);
e.setAdditionalMessage(message);
throw e;
}
}
public static void checkNull(Object arg, String message) {
if (arg == null) {
ArgumentException e = new ArgumentException(ArgumentErrors.NOT_NULL);
e.setAdditionalMessage(message);
throw e;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy