Class DriverUtils


  • public class DriverUtils
    extends Object
    Utils methods are copied from flink-core for flink jdbc driver to avoid excessive dependency.
    • Constructor Detail

      • DriverUtils

        public DriverUtils()
    • 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, a NullPointerException with the given message is thrown.
        Parameters:
        reference - The object reference
        errorMessage - The message for the NullPointerException 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 an IllegalArgumentException if the condition is not met (evaluates to false). The exception will have the given error message.
        Parameters:
        condition - The condition to check
        errorMessage - The message for the IllegalArgumentException 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 via Character.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