Class DriverUtils
- java.lang.Object
-
- org.apache.flink.table.jdbc.utils.DriverUtils
-
public class DriverUtils extends Object
Utils methods are copied from flink-core for flink jdbc driver to avoid excessive dependency.
-
-
Constructor Summary
Constructors Constructor Description DriverUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkArgument(boolean condition, Object errorMessage)
Checks the given boolean condition, and throws anIllegalArgumentException
if the condition is not met (evaluates tofalse
).static <T> T
checkNotNull(T reference, String errorMessage)
Ensures that the given object reference is not null.static Map<String,String>
fromProperties(Properties properties)
Generate map from given properties.static boolean
isNullOrWhitespaceOnly(String str)
Checks if the string is null, empty, or contains only whitespace characters.
-
-
-
Method Detail
-
checkNotNull
public static <T> T checkNotNull(@Nullable T reference, @Nullable String errorMessage)
Ensures that the given object reference is not null. Upon violation, aNullPointerException
with the given message is thrown.- Parameters:
reference
- The object referenceerrorMessage
- The message for theNullPointerException
that is thrown if the check fails.- Returns:
- The object reference itself (generically typed).
- Throws:
NullPointerException
- Thrown, if the passed reference was null.
-
checkArgument
public static void checkArgument(boolean condition, @Nullable Object errorMessage)
Checks the given boolean condition, and throws anIllegalArgumentException
if the condition is not met (evaluates tofalse
). The exception will have the given error message.- Parameters:
condition
- The condition to checkerrorMessage
- The message for theIllegalArgumentException
that is thrown if the check fails.- Throws:
IllegalArgumentException
- Thrown, if the condition is violated.
-
isNullOrWhitespaceOnly
public static boolean isNullOrWhitespaceOnly(String str)
Checks if the string is null, empty, or contains only whitespace characters. A whitespace character is defined viaCharacter.isWhitespace(char)
.- Parameters:
str
- The string to check- Returns:
- True, if the string is null or blank, false otherwise.
-
fromProperties
public static Map<String,String> fromProperties(Properties properties)
Generate map from given properties.- Parameters:
properties
- the given properties- Returns:
- the result map
-
-