Class ValidationUtils

java.lang.Object
cn.com.anysdk.core.util.ValidationUtils

public class ValidationUtils extends Object
验证工具类
  • Method Details

    • isNull

      public static boolean isNull(Object obj)
      验证对象是否为空
      Parameters:
      obj - 对象
      Returns:
      是否为空
    • isNotNull

      public static boolean isNotNull(Object obj)
      验证对象是否不为空
      Parameters:
      obj - 对象
      Returns:
      是否不为空
    • isEmpty

      public static boolean isEmpty(String str)
      验证字符串是否为空
      Parameters:
      str - 字符串
      Returns:
      是否为空
    • isNotEmpty

      public static boolean isNotEmpty(String str)
      验证字符串是否不为空
      Parameters:
      str - 字符串
      Returns:
      是否不为空
    • isEmpty

      public static boolean isEmpty(Collection<?> collection)
      验证集合是否为空
      Parameters:
      collection - 集合
      Returns:
      是否为空
    • isNotEmpty

      public static boolean isNotEmpty(Collection<?> collection)
      验证集合是否不为空
      Parameters:
      collection - 集合
      Returns:
      是否不为空
    • isEmpty

      public static boolean isEmpty(Map<?,?> map)
      验证Map是否为空
      Parameters:
      map - Map
      Returns:
      是否为空
    • isNotEmpty

      public static boolean isNotEmpty(Map<?,?> map)
      验证Map是否不为空
      Parameters:
      map - Map
      Returns:
      是否不为空
    • isEmpty

      public static boolean isEmpty(Object[] array)
      验证数组是否为空
      Parameters:
      array - 数组
      Returns:
      是否为空
    • isNotEmpty

      public static boolean isNotEmpty(Object[] array)
      验证数组是否不为空
      Parameters:
      array - 数组
      Returns:
      是否不为空
    • isNumeric

      public static boolean isNumeric(String str)
      验证字符串是否为数字
      Parameters:
      str - 字符串
      Returns:
      是否为数字
    • isEmail

      public static boolean isEmail(String email)
      验证字符串是否为邮箱
      Parameters:
      email - 邮箱
      Returns:
      是否为邮箱
    • isPhone

      public static boolean isPhone(String phone)
      验证字符串是否为手机号
      Parameters:
      phone - 手机号
      Returns:
      是否为手机号
    • isIdCard

      public static boolean isIdCard(String idCard)
      验证字符串是否为身份证号
      Parameters:
      idCard - 身份证号
      Returns:
      是否为身份证号
    • isUrl

      public static boolean isUrl(String url)
      验证字符串是否为URL
      Parameters:
      url - URL
      Returns:
      是否为URL
    • isIpv4

      public static boolean isIpv4(String ipv4)
      验证字符串是否为IPv4地址
      Parameters:
      ipv4 - IPv4地址
      Returns:
      是否为IPv4地址
    • isIpv6

      public static boolean isIpv6(String ipv6)
      验证字符串是否为IPv6地址
      Parameters:
      ipv6 - IPv6地址
      Returns:
      是否为IPv6地址
    • isLengthBetween

      public static boolean isLengthBetween(String str, int minLength, int maxLength)
      验证字符串是否在指定长度范围内
      Parameters:
      str - 字符串
      minLength - 最小长度
      maxLength - 最大长度
      Returns:
      是否在指定长度范围内
    • isNumberBetween

      public static boolean isNumberBetween(int number, int min, int max)
      验证数字是否在指定范围内
      Parameters:
      number - 数字
      min - 最小值
      max - 最大值
      Returns:
      是否在指定范围内
    • isNumberBetween

      public static boolean isNumberBetween(long number, long min, long max)
      验证数字是否在指定范围内
      Parameters:
      number - 数字
      min - 最小值
      max - 最大值
      Returns:
      是否在指定范围内
    • isNumberBetween

      public static boolean isNumberBetween(double number, double min, double max)
      验证数字是否在指定范围内
      Parameters:
      number - 数字
      min - 最小值
      max - 最大值
      Returns:
      是否在指定范围内