类 JtlwCheckVariateUtils
java.lang.Object
javabase.lorenwang.tools.common.JtlwCheckVariateUtils
public class JtlwCheckVariateUtils extends Object
功能作用:变量检测工具类
创建时间:2019-01-28 下午 14:02:18
创建人:王亮(Loren wang)
思路:
方法:
判断变量是否为空--isEmpty(T)
判断变量是否为不为空--isNotEmpty(T)
判断变量集合当中是否存在空--isHaveEmpty(Object...)
判断是否符合指定的正则表达式--matches(str, patternStr)
判断字符串是否是整型--isInteger(str)
判断字符串是否是长整型--isLong(str)
判断字符串是否是浮点数--isDouble(str)
字符串是否超过指定长度--isOverLength(str,len)
Double类型是否超过指定长度(小数点前位数)--isOverLength(d, len)
判断字符串是否在列表中--isInList(item, list)
判断对象是否在数组中--isInArray(item, T[])
检查传入的路径是否是图片--checkIsImage(path)
检查传入的路径是否是视频--checkIsVideo(path)
检查文件是否存在--checkFileIsExit(filePath)
检测文件是否是图片--checkFileIsImage(filePath)
检测国内身份证号是否正确,支持15位至18位--checkChineseIdCard(idCard)\
通过身份证号检测年龄是否超过限制--checkAgeMoreThanLimitByIdCard(idCard,limit, judgeYear)
注意:
修改人:
修改时间:
备注:
-
方法概要
修饰符和类型 方法 说明 booleancheckAgeMoreThanLimitByIdCard(@NotNull String idCard, int limit, boolean judgeYear)通过身份证号检测年龄是否超过限制intcheckChineseIdCard(@NotNull String idCard)检测国内身份证号是否正确,支持15位至18位booleancheckFileIsExit(String filePath)检查文件是否存在booleancheckFileIsImage(String filePath)检测文件是否是图片booleancheckIsImage(String path)检查传入的路径是否是图片booleancheckIsVideo(String path)检查传入的路径是否是视频static JtlwCheckVariateUtilsgetInstance()booleanisDouble(String str)判断字符串是否是浮点数<T> booleanisEmpty(T str)判断变量是否为空booleanisHaveEmpty(Object... objects)判断变量集合当中是否存在空<T> booleanisInArray(T item, T[] list)判断对象是否在数组中<T> booleanisInList(T item, List<T> list)判断字符串是否在列表中booleanisInteger(String str)判断字符串是否是整型booleanisLong(String str)判断字符串是否是长整型<T> booleanisNotEmpty(T str)判断变量是否为不为空booleanisOverLength(Double d, int len)Double类型是否超过指定长度(小数点前位数)booleanisOverLength(String str, int len)字符串是否超过指定长度booleanmatches(String str, String patternStr)判断是否符合指定的正则表达式 eg: [^0-9A-Za-z]
-
方法详细资料
-
getInstance
-
isEmpty
public <T> boolean isEmpty(T str)判断变量是否为空- 类型参数:
T- 变量泛型- 参数:
str- String- 返回:
- boolean
-
isNotEmpty
public <T> boolean isNotEmpty(T str)判断变量是否为不为空- 类型参数:
T- 变量泛型- 参数:
str- String- 返回:
- boolean
-
isHaveEmpty
判断变量集合当中是否存在空- 参数:
objects- 集合数据- 返回:
- 存在空返回true
-
matches
判断是否符合指定的正则表达式 eg: [^0-9A-Za-z]- 参数:
str- StringpatternStr- String- 返回:
- boolean
-
isInteger
判断字符串是否是整型- 参数:
str- String- 返回:
- boolean
-
isLong
判断字符串是否是长整型- 参数:
str- String- 返回:
- boolean
-
isDouble
判断字符串是否是浮点数- 参数:
str- String- 返回:
- boolean
-
isOverLength
字符串是否超过指定长度- 参数:
str- Stringlen- int- 返回:
- boolean
-
isOverLength
Double类型是否超过指定长度(小数点前位数)- 参数:
d- Doublelen- int- 返回:
- boolean
-
isInList
判断字符串是否在列表中- 类型参数:
T- 变量泛型- 参数:
item- item数据list- 列表- 返回:
- 存在返回true
-
isInArray
public <T> boolean isInArray(T item, T[] list)判断对象是否在数组中- 类型参数:
T- 泛型- 参数:
item- 对象数据list- 集合数据- 返回:
- 存在返回true
-
checkIsImage
检查传入的路径是否是图片- 参数:
path- 传入路径- 返回:
- 是图片返回true
-
checkIsVideo
检查传入的路径是否是视频- 参数:
path- 传入路径- 返回:
- 是视频返回true
-
checkFileIsExit
检查文件是否存在- 参数:
filePath- 文件地址- 返回:
- 存在返回true
-
checkFileIsImage
检测文件是否是图片- 参数:
filePath- 文件地址- 返回:
- 是图片返回true
-
checkChineseIdCard
检测国内身份证号是否正确,支持15位至18位- 参数:
idCard- 身份证号- 返回:
- 0 通过,1 格式错误,2 地址编码错误,3 身份证号不合法
-
checkAgeMoreThanLimitByIdCard
public boolean checkAgeMoreThanLimitByIdCard(@NotNull @NotNull String idCard, int limit, boolean judgeYear)通过身份证号检测年龄是否超过限制- 参数:
idCard- 身份证号limit- 限制judgeYear- 是否单纯按照年份判断- 返回:
- 是则是超过限制
-