All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zusmart.base.util.Assert Maven / Gradle / Ivy

Go to download

提供基础的工具类及方法类,Logging,Scanner,Buffer,NetWork,Future,Thread

There is a newer version: 1.0.6
Show newest version
package com.zusmart.base.util;

public abstract class Assert {

	/**
	 * 断言,字符串为空时抛出{@link IllegalArgumentException}异常
	 * 
	 * @param value
	 *            需要判断的值
	 * @param message
	 *            异常信息
	 */
	public static void isBlank(CharSequence value, String message) {
		if (StringUtils.isBlank(value)) {
			throw new IllegalArgumentException(message);
		}
	}

	/**
	 * 断言,对象为空时抛出{@link IllegalArgumentException}异常
	 * 
	 * @param value
	 *            需要判断的值
	 * @param message
	 *            异常信息
	 */
	public static void isNull(Object value, String message) {
		if (null == value) {
			throw new IllegalArgumentException(message);
		}
	}

	/**
	 * 断言,判断指定结果是否为true,true则抛出{@link IllegalArgumentException}异常
	 * 
	 * @param value
	 *            需要判断的值
	 * @param message
	 *            异常信息
	 */
	public static void isTrue(boolean value, String message) {
		if (value) {
			throw new IllegalArgumentException(message);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy