Class ValidationUtil
java.lang.Object
com.databricks.jdbc.common.util.ValidationUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckHTTPError(org.apache.http.HttpResponse response) static <T extends Number>
voidcheckIfNonNegative(T number, String fieldName) static booleanisValidJdbcUrl(String url) Validates the JDBC URL.static voidthrowErrorIfNull(String field, Object value) static voidthrowErrorIfNull(Map<String, String> fields, String context) static voidvalidateInputProperties(Map<String, String> parameters) Validates all input properties for JDBC connection parameters.static voidvalidateUidParameter(Map<String, String> parameters) Validates the UID parameter in JDBC connection properties.
-
Constructor Details
-
ValidationUtil
public ValidationUtil()
-
-
Method Details
-
checkIfNonNegative
public static <T extends Number> void checkIfNonNegative(T number, String fieldName) throws DatabricksSQLException - Throws:
DatabricksSQLException
-
throwErrorIfNull
public static void throwErrorIfNull(Map<String, String> fields, String context) throws DatabricksSQLException- Throws:
DatabricksSQLException
-
throwErrorIfNull
- Throws:
DatabricksSQLException
-
checkHTTPError
public static void checkHTTPError(org.apache.http.HttpResponse response) throws DatabricksHttpException, IOException - Throws:
DatabricksHttpExceptionIOException
-
isValidJdbcUrl
Validates the JDBC URL.- Parameters:
url- JDBC URL- Returns:
- true if the URL is valid, false otherwise
-
validateInputProperties
public static void validateInputProperties(Map<String, String> parameters) throws DatabricksSQLExceptionValidates all input properties for JDBC connection parameters. This method serves as a central validation entry point, consolidating all property validations in one place for better maintainability and extensibility.- Parameters:
parameters- Map of JDBC connection parameters to validate- Throws:
DatabricksSQLException- if any validation fails
-
validateUidParameter
public static void validateUidParameter(Map<String, String> parameters) throws DatabricksSQLExceptionValidates the UID parameter in JDBC connection properties. UID must either be omitted or set to "token".- Parameters:
parameters- Map of JDBC connection parameters- Throws:
DatabricksSQLException- if UID validation fails
-