Package com.clickhouse.data
Class ClickHouseChecker
java.lang.Object
com.clickhouse.data.ClickHouseChecker
Utility class for validation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intChecks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.static intbetween(int value, int minValue, int maxValue) Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.static intChecks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.static longbetween(long value, long minValue, long maxValue) Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.static longChecks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.static BigDecimalbetween(BigDecimal value, String name, BigDecimal minValue, BigDecimal maxValue) Checks if the givenvalueis betweenminValueandmaxValue*exclusive* and throws a customizedIllegalArgumentExceptionif it is NOT.static BigDecimalbetween(BigDecimal value, BigDecimal minValue, BigDecimal maxValue) Checks if the givenvalueis betweenminValueandmaxValue*exclusive* and throws a customizedIllegalArgumentExceptionif it is NOT.static BigIntegerbetween(BigInteger value, String name, BigInteger minValue, BigInteger maxValue) Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.static BigIntegerbetween(BigInteger value, BigInteger minValue, BigInteger maxValue) Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.static booleanisNullOrBlank(CharSequence value) Checks if the given string is null, empty string or a string only contains white spaces.static booleanisNullOrEmpty(CharSequence value) Checks if the given string isnullor empty.static StringChecks if the given string is notnull, empty or blank and throws a customizedIllegalArgumentExceptionif it is.static StringChecks if the given string is neithernullnor empty and throws a customizedIllegalArgumentExceptionif it is.static final <T> TChecks if the given object is NOTnulland throws a customizedIllegalArgumentExceptionif it is.static intnotLessThan(int value, String name, int minValue) Checks if the givenvalueis NOT less thanminValueand throws a customizedIllegalArgumentExceptionif it is.static longnotLessThan(long value, String name, long minValue) Checks if the givenvalueis NOT less thanminValueand throws a customizedIllegalArgumentExceptionif it is.static BigIntegernotLessThan(BigInteger value, String name, BigInteger minValue) Checks if the givenvalueis NOT less thanminValueand throws a customizedIllegalArgumentExceptionif it is.static byte[]notLongerThan(byte[] value, String name, int maxLength) Checks if length of the given byte array is NOT greater thanlengthand throws a customizedIllegalArgumentExceptionif it is.
-
Method Details
-
between
public static int between(int value, int minValue, int maxValue) Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
between
public static long between(long value, long minValue, long maxValue) Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
between
Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkname- name of the valueminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
between
Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkname- name of the valueminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
between
Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkname- name of the valueminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
between
Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
between
public static BigInteger between(BigInteger value, String name, BigInteger minValue, BigInteger maxValue) Checks if the givenvalueis betweenminValueandmaxValueinclusive and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkname- name of the valueminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
between
Checks if the givenvalueis betweenminValueandmaxValue*exclusive* and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
between
public static BigDecimal between(BigDecimal value, String name, BigDecimal minValue, BigDecimal maxValue) Checks if the givenvalueis betweenminValueandmaxValue*exclusive* and throws a customizedIllegalArgumentExceptionif it is NOT.- Parameters:
value- the value to checkname- name of the valueminValue- minimum value to compare withmaxValue- maximum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis NOT betweenminValueandmaxValue
-
isNullOrEmpty
Checks if the given string isnullor empty.- Parameters:
value- the string to check- Returns:
- true if the string is null or empty; false otherwise
-
isNullOrBlank
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
Checks if the given string is notnull, empty or blank and throws a customizedIllegalArgumentExceptionif it is.- Parameters:
value- the string to checkname- name of the string- Returns:
- the exact same string
- Throws:
IllegalArgumentException- if the string is null, empty or blank
-
nonEmpty
Checks if the given string is neithernullnor empty and throws a customizedIllegalArgumentExceptionif it is.- Parameters:
value- the string to checkname- name of the string- Returns:
- the exact same string
- Throws:
IllegalArgumentException- if the string is null or empty
-
nonNull
Checks if the given object is NOTnulland throws a customizedIllegalArgumentExceptionif it is.- Type Parameters:
T- type of the object- Parameters:
value- the objectname- name of the object- Returns:
- the exact same object
- Throws:
IllegalArgumentException- if the object is null
-
notLessThan
Checks if the givenvalueis NOT less thanminValueand throws a customizedIllegalArgumentExceptionif it is.- Parameters:
value- the value to checkname- name of the valueminValue- minimum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis less thanminValue
-
notLessThan
Checks if the givenvalueis NOT less thanminValueand throws a customizedIllegalArgumentExceptionif it is.- Parameters:
value- the value to checkname- name of the valueminValue- minimum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis less thanminValue
-
notLessThan
Checks if the givenvalueis NOT less thanminValueand throws a customizedIllegalArgumentExceptionif it is.- Parameters:
value- the value to checkname- name of the valueminValue- minimum value to compare with- Returns:
- the exact same value
- Throws:
IllegalArgumentException- if thevalueis less thanminValue
-
notLongerThan
Checks if length of the given byte array is NOT greater thanlengthand throws a customizedIllegalArgumentExceptionif it is.- Parameters:
value- the byte array to checkname- name of the byte arraymaxLength- maximum length of the byte array- Returns:
- the exact same byte array
- Throws:
IllegalArgumentException- if length of the byte array is greater thanmaxlength
-