public class LocalizedAssert<E extends java.lang.RuntimeException> extends java.lang.Object implements ILocalizedAssert
| Constructor and Description |
|---|
LocalizedAssert(java.lang.Class<E> exceptionType)
Instantiates a new localized assert.
|
LocalizedAssert(java.lang.Class<E> exceptionType,
java.util.function.Function<java.lang.String,E> newException)
Instantiates a new localized assert.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
<N extends java.lang.Number> |
isGe(N value,
N min,
java.lang.String arguDescp)
if value is < min throw exception.
|
<N extends java.lang.Number> |
isGe(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N min)
if value is < min throw exception.
|
<N extends java.lang.Number> |
isGt(N value,
N min,
java.lang.String arguDescp)
if value is <= min throw exception.
|
<N extends java.lang.Number> |
isGt(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N min)
if value is <= min throw exception.
|
<N extends java.lang.Number> |
isInRange(N value,
N min,
N max,
java.lang.String arguDescp)
if value is <= min or >= max, throw exception.
|
<N extends java.lang.Number> |
isInRange(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N min,
N max)
if value is <= min or >= max, throw exception.
|
void |
isInstanceOf(java.lang.Class<?> clazz,
java.lang.Object obj)
判断对象(第二个参数)是指定类型(第一个参数)的实例,判断失败抛出指定异常 .
|
<N extends java.lang.Number> |
isLe(N value,
N max,
java.lang.String arguDescp)
if value is > max, throw exception.
|
<N extends java.lang.Number> |
isLe(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N max)
if value is > max, throw exception.
|
<N extends java.lang.Number> |
isLt(N value,
N max,
java.lang.String arguDescp)
if value is >= max, throw exception.
|
<N extends java.lang.Number> |
isLt(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N max)
if value is >= max, throw exception.
|
void |
isNotBlank(cn.featherfly.common.function.serializable.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.function.serializable.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.function.serializable.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 - the exception typepublic void isNotNull(java.lang.Object object,
java.lang.String arg)
isNotNull in interface ILocalizedAssertobject - 判断的对象arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotBlank(java.lang.String text,
java.lang.String arg)
isNotBlank in interface ILocalizedAsserttext - 判断的字符串arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.lang.Object obj,
java.lang.String args)
isNotEmpty in interface ILocalizedAssertobj - 判断的对象args - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.lang.String text,
java.lang.String arg)
isNotEmpty in interface ILocalizedAsserttext - 判断的字符串arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.lang.Object[] array,
java.lang.String arg)
isNotEmpty in interface ILocalizedAssertarray - 需要判断的数组arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.util.Collection<?> collection,
java.lang.String arg)
isNotEmpty in interface ILocalizedAssertcollection - 判断的集合arg - 出错时对参数的描述信息,例如:user.id、username等等public void isNotEmpty(java.util.Map<?,?> map,
java.lang.String arg)
isNotEmpty in interface ILocalizedAssertmap - 判断的集合arg - 出错时对参数的描述信息,例如:user.id、username等等public void isExists(java.io.File file,
java.lang.String args)
isExists in interface ILocalizedAssertfile - 判断的文件对象args - 出错时对参数的描述信息,例如:uploadFile等等public void isFile(java.io.File file,
java.lang.String args)
isFile in interface ILocalizedAssertfile - 判断的文件对象args - 出错时对参数的描述信息,例如:uploadFile等等public void isDirectory(java.io.File file,
java.lang.String args)
isDirectory in interface ILocalizedAssertfile - 判断的文件对象args - 出错时对参数的描述信息,例如:uploadFile等等public void isInstanceOf(java.lang.Class<?> clazz,
java.lang.Object obj)
isInstanceOf in interface ILocalizedAssertclazz - 类型obj - 对象public void isParent(java.lang.Class<?> parentType,
java.lang.Class<?> subType)
isParent in interface ILocalizedAssertparentType - 父类型subType - 子类型public void isNotInterface(java.lang.Class<?> classType)
isNotInterface in interface ILocalizedAssertclassType - the class typepublic <N extends java.lang.Number> void isInRange(N value,
N min,
N max,
java.lang.String arguDescp)
isInRange in interface ILocalizedAssertN - the number typevalue - valuemin - minmax - maxarguDescp - arguDescppublic <N extends java.lang.Number> void isInRange(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N min,
N max)
isInRange in interface ILocalizedAssertN - the number typevalue - the valuemin - the minmax - the maxpublic <N extends java.lang.Number> void isGt(N value,
N min,
java.lang.String arguDescp)
isGt in interface ILocalizedAssertN - the number typevalue - valuemin - minarguDescp - arguDescppublic <N extends java.lang.Number> void isGt(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N min)
isGt in interface ILocalizedAssertN - the number typevalue - valuemin - minpublic <N extends java.lang.Number> void isGe(N value,
N min,
java.lang.String arguDescp)
isGe in interface ILocalizedAssertN - the number typevalue - valuemin - minarguDescp - arguDescppublic <N extends java.lang.Number> void isGe(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N min)
isGe in interface ILocalizedAssertN - the number typevalue - valuemin - minpublic <N extends java.lang.Number> void isLt(N value,
N max,
java.lang.String arguDescp)
isLt in interface ILocalizedAssertN - the number typevalue - valuemax - maxarguDescp - arguDescppublic <N extends java.lang.Number> void isLt(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N max)
isLt in interface ILocalizedAssertN - the number typevalue - valuemax - maxpublic <N extends java.lang.Number> void isLe(N value,
N max,
java.lang.String arguDescp)
isLe in interface ILocalizedAssertN - the number typevalue - valuemax - maxarguDescp - arguDescppublic <N extends java.lang.Number> void isLe(cn.featherfly.common.function.serializable.SerializableNumberSupplier<N> value,
N max)
isLe in interface ILocalizedAssertN - the number typevalue - valuemax - maxpublic <T> void isNotNull(cn.featherfly.common.function.serializable.SerializableSupplier<T> propertySupplier)
isNotNull in interface ILocalizedAssertT - the generic typepropertySupplier - object property lambdapublic void isNotBlank(cn.featherfly.common.function.serializable.SerializableSupplier<java.lang.String> propertySupplier)
isNotBlank in interface ILocalizedAssertpropertySupplier - object property lambdapublic <T> void isNotEmpty(cn.featherfly.common.function.serializable.SerializableSupplier<T> propertySupplier)
isNotEmpty in interface ILocalizedAssertT - the generic typepropertySupplier - object property lambda