Package io.mybatis.common.util
Class Assert
- java.lang.Object
-
- io.mybatis.common.util.Assert
-
public class Assert extends Object
基本断言类,抛出断言异常信息- Author:
- liuzh
-
-
Constructor Summary
Constructors Constructor Description Assert()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends CharSequence>
voidisBlank(T text, Code code)检查给定字符串是否为空白(null、空串或只包含空白符)static <T extends CharSequence>
voidisBlank(T text, String message)检查给定字符串是否为空白(null、空串或只包含空白符)static <T> voidisEmpty(Collection<T> collection, Code code)检查给定集合是否为空static <T> voidisEmpty(Collection<T> collection, String message)检查给定集合是否为空static <T> voidisEmpty(T[] array, Code code)检查给定数组是否为空static <T> voidisEmpty(T[] array, String message)检查给定数组是否为空static <T extends CharSequence>
voidisEmpty(T text, Code code)检查给定字符串是否为空static <T extends CharSequence>
voidisEmpty(T text, String message)检查给定字符串是否为空static voidisFalse(boolean expression, Code code)断言是否为假static voidisFalse(boolean expression, String message)断言是否为假static voidisNull(Object object, Code code)断言对象是否为nullstatic voidisNull(Object object, String message)断言对象是否为nullstatic voidisTrue(boolean expression, Code code)断言是否为真static voidisTrue(boolean expression, String message)断言是否为真static <T extends CharSequence>
voidnotBlank(T text, Code code)检查给定字符串是否为空白(null、空串或只包含空白符)static <T extends CharSequence>
voidnotBlank(T text, String message)检查给定字符串是否为空白(null、空串或只包含空白符)static <T> voidnotEmpty(Collection<T> collection, Code code)检查给定集合是否非空static <T> voidnotEmpty(Collection<T> collection, String message)检查给定集合是否非空static <T> voidnotEmpty(T[] array, Code code)检查给定数组是否非空static <T> voidnotEmpty(T[] array, String message)检查给定数组是否非空static <T extends CharSequence>
voidnotEmpty(T text, Code code)检查给定字符串是否为空static <T extends CharSequence>
voidnotEmpty(T text, String message)检查给定字符串是否为空static voidnotNull(Object object, Code code)断言对象是否补为nullstatic voidnotNull(Object object, String message)断言对象是否不为null
-
-
-
Method Detail
-
isTrue
public static void isTrue(boolean expression, String message)断言是否为真- Parameters:
expression- 布尔值message- 异常消息
-
isTrue
public static void isTrue(boolean expression, Code code)断言是否为真- Parameters:
expression- 布尔值code- 错误码
-
isFalse
public static void isFalse(boolean expression, String message)断言是否为假- Parameters:
expression- 布尔值message- 异常消息
-
isFalse
public static void isFalse(boolean expression, Code code)断言是否为假- Parameters:
expression- 布尔值code- 错误码
-
isNull
public static void isNull(Object object, String message)
断言对象是否为null- Parameters:
object- 被检查的对象message- 异常消息
-
isNull
public static void isNull(Object object, Code code)
断言对象是否为null- Parameters:
object- 被检查的对象code- 错误码
-
notNull
public static void notNull(Object object, String message)
断言对象是否不为null- Parameters:
object- 被检查的对象message- 异常消息
-
notNull
public static void notNull(Object object, Code code)
断言对象是否补为null- Parameters:
object- 被检查的对象code- 错误码
-
isEmpty
public static <T extends CharSequence> void isEmpty(T text, String message)
检查给定字符串是否为空- Parameters:
text- 字符串类型message- 异常消息
-
isEmpty
public static <T extends CharSequence> void isEmpty(T text, Code code)
检查给定字符串是否为空- Parameters:
text- 字符串类型code- 错误码
-
notEmpty
public static <T extends CharSequence> void notEmpty(T text, String message)
检查给定字符串是否为空- Parameters:
text- 字符串类型message- 异常消息
-
notEmpty
public static <T extends CharSequence> void notEmpty(T text, Code code)
检查给定字符串是否为空- Parameters:
text- 字符串类型code- 错误码
-
isBlank
public static <T extends CharSequence> void isBlank(T text, String message)
检查给定字符串是否为空白(null、空串或只包含空白符)- Parameters:
text- 字符串类型message- 异常消息
-
isBlank
public static <T extends CharSequence> void isBlank(T text, Code code)
检查给定字符串是否为空白(null、空串或只包含空白符)- Parameters:
text- 字符串类型code- 错误码
-
notBlank
public static <T extends CharSequence> void notBlank(T text, String message)
检查给定字符串是否为空白(null、空串或只包含空白符)- Parameters:
text- 字符串类型message- 异常消息
-
notBlank
public static <T extends CharSequence> void notBlank(T text, Code code)
检查给定字符串是否为空白(null、空串或只包含空白符)- Parameters:
text- 字符串类型code- 错误码
-
isEmpty
public static <T> void isEmpty(T[] array, String message)检查给定数组是否为空- Parameters:
array- 数组message- 异常消息
-
isEmpty
public static <T> void isEmpty(T[] array, Code code)检查给定数组是否为空- Parameters:
array- 数组code- 错误码
-
notEmpty
public static <T> void notEmpty(T[] array, String message)检查给定数组是否非空- Parameters:
array- 数组message- 异常消息
-
notEmpty
public static <T> void notEmpty(T[] array, Code code)检查给定数组是否非空- Parameters:
array- 数组code- 错误码
-
isEmpty
public static <T> void isEmpty(Collection<T> collection, String message)
检查给定集合是否为空- Parameters:
collection- 集合message- 异常消息
-
isEmpty
public static <T> void isEmpty(Collection<T> collection, Code code)
检查给定集合是否为空- Parameters:
collection- 集合code- 错误码
-
notEmpty
public static <T> void notEmpty(Collection<T> collection, String message)
检查给定集合是否非空- Parameters:
collection- 集合message- 异常消息
-
notEmpty
public static <T> void notEmpty(Collection<T> collection, Code code)
检查给定集合是否非空- Parameters:
collection- 集合code- 错误码
-
-