Class ClickHouseChecker

java.lang.Object
com.clickhouse.data.ClickHouseChecker

public final class ClickHouseChecker extends Object
Utility class for validation.
  • Method Details

    • between

      public static int between(int value, int minValue, int maxValue)
      Checks if the given value is between minValue and maxValue inclusive and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • between

      public static long between(long value, long minValue, long maxValue)
      Checks if the given value is between minValue and maxValue inclusive and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • between

      public static int between(byte value, String name, byte minValue, byte maxValue)
      Checks if the given value is between minValue and maxValue inclusive and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      name - name of the value
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • between

      public static int between(int value, String name, int minValue, int maxValue)
      Checks if the given value is between minValue and maxValue inclusive and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      name - name of the value
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • between

      public static long between(long value, String name, long minValue, long maxValue)
      Checks if the given value is between minValue and maxValue inclusive and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      name - name of the value
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • between

      public static BigInteger between(BigInteger value, BigInteger minValue, BigInteger maxValue)
      Checks if the given value is between minValue and maxValue inclusive and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • between

      public static BigInteger between(BigInteger value, String name, BigInteger minValue, BigInteger maxValue)
      Checks if the given value is between minValue and maxValue inclusive and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      name - name of the value
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • between

      public static BigDecimal between(BigDecimal value, BigDecimal minValue, BigDecimal maxValue)
      Checks if the given value is between minValue and maxValue *exclusive* and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • between

      public static BigDecimal between(BigDecimal value, String name, BigDecimal minValue, BigDecimal maxValue)
      Checks if the given value is between minValue and maxValue *exclusive* and throws a customized IllegalArgumentException if it is NOT.
      Parameters:
      value - the value to check
      name - name of the value
      minValue - minimum value to compare with
      maxValue - maximum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is NOT between minValue and maxValue
    • isNullOrEmpty

      public static boolean isNullOrEmpty(CharSequence value)
      Checks if the given string is null or empty.
      Parameters:
      value - the string to check
      Returns:
      true if the string is null or empty; false otherwise
    • isNullOrBlank

      public static boolean isNullOrBlank(CharSequence value)
      Checks if the given string is null, empty string or a string only contains white spaces.
      Parameters:
      value - the string to check
      Returns:
      true if the string is null, empty or blankļ¼› false otherwise
    • nonBlank

      public static String nonBlank(String value, String name)
      Checks if the given string is not null, empty or blank and throws a customized IllegalArgumentException if it is.
      Parameters:
      value - the string to check
      name - name of the string
      Returns:
      the exact same string
      Throws:
      IllegalArgumentException - if the string is null, empty or blank
    • nonEmpty

      public static String nonEmpty(String value, String name)
      Checks if the given string is neither null nor empty and throws a customized IllegalArgumentException if it is.
      Parameters:
      value - the string to check
      name - name of the string
      Returns:
      the exact same string
      Throws:
      IllegalArgumentException - if the string is null or empty
    • nonNull

      public static final <T> T nonNull(T value, String name)
      Checks if the given object is NOT null and throws a customized IllegalArgumentException if it is.
      Type Parameters:
      T - type of the object
      Parameters:
      value - the object
      name - name of the object
      Returns:
      the exact same object
      Throws:
      IllegalArgumentException - if the object is null
    • notLessThan

      public static int notLessThan(int value, String name, int minValue)
      Checks if the given value is NOT less than minValue and throws a customized IllegalArgumentException if it is.
      Parameters:
      value - the value to check
      name - name of the value
      minValue - minimum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is less than minValue
    • notLessThan

      public static long notLessThan(long value, String name, long minValue)
      Checks if the given value is NOT less than minValue and throws a customized IllegalArgumentException if it is.
      Parameters:
      value - the value to check
      name - name of the value
      minValue - minimum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is less than minValue
    • notLessThan

      public static BigInteger notLessThan(BigInteger value, String name, BigInteger minValue)
      Checks if the given value is NOT less than minValue and throws a customized IllegalArgumentException if it is.
      Parameters:
      value - the value to check
      name - name of the value
      minValue - minimum value to compare with
      Returns:
      the exact same value
      Throws:
      IllegalArgumentException - if the value is less than minValue
    • notLongerThan

      public static byte[] notLongerThan(byte[] value, String name, int maxLength)
      Checks if length of the given byte array is NOT greater than length and throws a customized IllegalArgumentException if it is.
      Parameters:
      value - the byte array to check
      name - name of the byte array
      maxLength - maximum length of the byte array
      Returns:
      the exact same byte array
      Throws:
      IllegalArgumentException - if length of the byte array is greater than maxlength