Package org.influxdb.impl
Class Preconditions
java.lang.Object
org.influxdb.impl.Preconditions
public final class Preconditions extends Object
Functions for parameter validation.
- Author:
- Simon Legner
-
Method Summary
Modifier and Type Method Description static void
checkDuration(String duration, String name)
Enforces that the duration is a valid influxDB duration.static String
checkNonEmptyString(String string, String name)
Enforces that the string is not empty.static void
checkNotNegativeNumber(Number number, String name)
Enforces that the number is not negative.static void
checkPositiveNumber(Number number, String name)
Enforces that the number is larger than 0.
-
Method Details
-
checkNonEmptyString
public static String checkNonEmptyString(String string, String name) throws IllegalArgumentExceptionEnforces that the string is not empty.- Parameters:
string
- the string to testname
- variable name for reporting- Returns:
string
- Throws:
IllegalArgumentException
- if the string is empty
-
checkPositiveNumber
Enforces that the number is larger than 0.- Parameters:
number
- the number to testname
- variable name for reporting- Throws:
IllegalArgumentException
- if the number is less or equal to 0
-
checkNotNegativeNumber
public static void checkNotNegativeNumber(Number number, String name) throws IllegalArgumentExceptionEnforces that the number is not negative.- Parameters:
number
- the number to testname
- variable name for reporting- Throws:
IllegalArgumentException
- if the number is less or equal to 0
-
checkDuration
Enforces that the duration is a valid influxDB duration.- Parameters:
duration
- the duration to testname
- variable name for reporting- Throws:
IllegalArgumentException
- if the given duration is not valid.
-