public class LocalizedAssert<E extends java.lang.RuntimeException> extends java.lang.Object implements ILocalizedAssert<E>
断言工具类,对于满足断言的情况,抛出支持国际化消息输出的异常 一般用于检查传入参数是否合法
| 构造器和说明 |
|---|
LocalizedAssert(java.lang.Class<E> exceptionType) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
isDirectory(java.io.File file,
java.lang.String args)
if arguDescpu file is not directory, throw exception.
|
void |
isExists(java.io.File file,
java.lang.String args)
判断传入文件对象代表的物理文件是否存在,判断失败抛出指定异常
.
|
void |
isFile(java.io.File file,
java.lang.String args)
if arguDescpu file is not a file, throw exception.
|
void |
isGe(int value,
int min,
java.lang.String arguDescp)
if value is < min throw exception.
|
void |
isGt(int value,
int min,
java.lang.String arguDescp)
if value is <= min throw exception.
|
void |
isInRange(int value,
int min,
int max,
java.lang.String arguDescp)
if value is < min or > max, throw exception.
|
void |
isInstanceOf(java.lang.Class<?> clazz,
java.lang.Object obj)
判断对象(第二个参数)是指定类型(第一个参数)的实例,判断失败抛出指定异常
.
|
void |
isLe(int value,
int max,
java.lang.String arguDescp)
if value is > max, throw exception.
|
void |
isLt(int value,
int max,
java.lang.String arguDescp)
if value is >= max, throw exception.
|
void |
isNotBlank(cn.featherfly.common.lang.function.SerializableSupplier<java.lang.String> propertySupplier)
判断不为空或空串(包括只有空字符的串),判断失败抛出指定异常
.
|
void |
isNotBlank(java.lang.String text,
java.lang.String arg)
判断不为空或空串(包括只有空字符的串),判断失败抛出指定异常
.
|
void |
isNotEmpty(java.util.Collection<?> collection,
java.lang.String arg)
判断集合不为null或size不为0,判断失败抛出指定异常
.
|
void |
isNotEmpty(java.util.Map<?,?> map,
java.lang.String arg)
判断MAP不为null或size不为0,判断失败抛出指定异常
.
|
void |
isNotEmpty(java.lang.Object[] array,
java.lang.String arg)
判断数组不为null或size不为0,判断失败抛出指定异常
.
|
void |
isNotEmpty(java.lang.Object obj,
java.lang.String args)
判断不为空(String,Collection,Map,Array还要判断长度是否为0),判断失败抛出指定异常
.
|
<T> void |
isNotEmpty(cn.featherfly.common.lang.function.SerializableSupplier<T> propertySupplier)
判断不为空(String,Collection,Map,Array还要判断长度是否为0),判断失败抛出指定异常
.
|
void |
isNotEmpty(java.lang.String text,
java.lang.String arg)
判断不为空或空串,判断失败抛出指定异常
.
|
void |
isNotInterface(java.lang.Class<?> classType)
if arguDescpu classType is interface, throw exception.
|
void |
isNotNull(java.lang.Object object,
java.lang.String arg)
判断不为空,如果为空,抛出指定异常
.
|
<T> void |
isNotNull(cn.featherfly.common.lang.function.SerializableSupplier<T> propertySupplier)
if null, throw exception
.
|
void |
isParent(java.lang.Class<?> parentType,
java.lang.Class<?> subType)
判断类型(第一个参数)是指定类型(第二个参数)的父类(包括接口实现和类继承),判断失败抛出指定异常
.
|
public LocalizedAssert(java.lang.Class<E> exceptionType)
exceptionType - 断言失败抛出的异常类型public void isNotNull(java.lang.Object object,
java.lang.String arg)
判断不为空,如果为空,抛出指定异常
.isNotNull 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>object - 判断的对象arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotBlank(java.lang.String text,
java.lang.String arg)
判断不为空或空串(包括只有空字符的串),判断失败抛出指定异常
.isNotBlank 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>text - 判断的字符串arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.lang.Object obj,
java.lang.String args)
判断不为空(String,Collection,Map,Array还要判断长度是否为0),判断失败抛出指定异常
.isNotEmpty 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>obj - 判断的对象args - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.lang.String text,
java.lang.String arg)
判断不为空或空串,判断失败抛出指定异常
.isNotEmpty 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>text - 判断的字符串arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.lang.Object[] array,
java.lang.String arg)
判断数组不为null或size不为0,判断失败抛出指定异常
.isNotEmpty 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>array - 需要判断的数组arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.util.Collection<?> collection,
java.lang.String arg)
判断集合不为null或size不为0,判断失败抛出指定异常
.isNotEmpty 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>collection - 判断的集合arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.util.Map<?,?> map,
java.lang.String arg)
判断MAP不为null或size不为0,判断失败抛出指定异常
.isNotEmpty 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>map - 判断的集合arg - 出错时对参数的描述信息,例如:user.id、username等等public void isExists(java.io.File file,
java.lang.String args)
判断传入文件对象代表的物理文件是否存在,判断失败抛出指定异常
.isExists 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>file - 判断的文件对象args - 出错时对参数的描述信息,例如:uploadFile等等public void isFile(java.io.File file,
java.lang.String args)
isFile 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>file - 判断的文件对象args - 出错时对参数的描述信息,例如:uploadFile等等public void isDirectory(java.io.File file,
java.lang.String args)
isDirectory 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>file - 判断的文件对象args - 出错时对参数的描述信息,例如:uploadFile等等public void isInstanceOf(java.lang.Class<?> clazz,
java.lang.Object obj)
判断对象(第二个参数)是指定类型(第一个参数)的实例,判断失败抛出指定异常
.isInstanceOf 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>clazz - 类型obj - 对象public void isParent(java.lang.Class<?> parentType,
java.lang.Class<?> subType)
判断类型(第一个参数)是指定类型(第二个参数)的父类(包括接口实现和类继承),判断失败抛出指定异常
.isParent 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>parentType - 父类型subType - 子类型public void isNotInterface(java.lang.Class<?> classType)
isNotInterface 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>classType - the class typepublic void isInRange(int value,
int min,
int max,
java.lang.String arguDescp)
isInRange 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>value - valuemin - minmax - maxarguDescp - arguDescppublic void isGt(int value,
int min,
java.lang.String arguDescp)
isGt 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>value - valuemin - minarguDescp - arguDescppublic void isGe(int value,
int min,
java.lang.String arguDescp)
isGe 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>value - valuemin - minarguDescp - arguDescppublic void isLt(int value,
int max,
java.lang.String arguDescp)
isLt 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>value - valuemax - maxarguDescp - arguDescppublic void isLe(int value,
int max,
java.lang.String arguDescp)
isLe 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>value - valuemax - maxarguDescp - arguDescppublic <T> void isNotNull(cn.featherfly.common.lang.function.SerializableSupplier<T> propertySupplier)
if null, throw exception
.isNotNull 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>T - the generic typepropertySupplier - object property lambdapublic void isNotBlank(cn.featherfly.common.lang.function.SerializableSupplier<java.lang.String> propertySupplier)
判断不为空或空串(包括只有空字符的串),判断失败抛出指定异常
.isNotBlank 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>propertySupplier - object property lambdapublic <T> void isNotEmpty(cn.featherfly.common.lang.function.SerializableSupplier<T> propertySupplier)
判断不为空(String,Collection,Map,Array还要判断长度是否为0),判断失败抛出指定异常
.isNotEmpty 在接口中 ILocalizedAssert<E extends java.lang.RuntimeException>T - the generic typepropertySupplier - object property lambda