Class ConverterHelper
- java.lang.Object
-
- com.databricks.jdbc.api.impl.converters.ConverterHelper
-
public class ConverterHelper extends Object
-
-
Constructor Summary
Constructors Constructor Description ConverterHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ObjectconvertSqlTypeToJavaType(int columnSqlType, Object object)Converts a SQL object to the appropriate Java object based on the SQL type.static ObjectconvertSqlTypeToSpecificJavaType(Class<?> javaType, int columnSqlType, Object obj)Converts an object to a specific Java type based on the provided SQL type and desired Java class.static ObjectConvertergetConverterForColumnType(int columnSqlType, String columnTypeName)Retrieves the appropriate ObjectConverter for a given SQL type and column type name.static ObjectConvertergetConverterForSqlType(int columnSqlType)Retrieves the appropriate ObjectConverter for a given SQL type.static booleanisConversionSupported(int fromType, int toType)
-
-
-
Method Detail
-
convertSqlTypeToJavaType
public static Object convertSqlTypeToJavaType(int columnSqlType, Object object) throws DatabricksSQLException
Converts a SQL object to the appropriate Java object based on the SQL type.- Parameters:
columnSqlType- The SQL type of the column, as defined in java.sql.Typesobject- The object to be converted- Returns:
- The converted Java object
- Throws:
DatabricksSQLException- If there's an error during the conversion process
-
convertSqlTypeToSpecificJavaType
public static Object convertSqlTypeToSpecificJavaType(Class<?> javaType, int columnSqlType, Object obj) throws DatabricksSQLException
Converts an object to a specific Java type based on the provided SQL type and desired Java class.- Parameters:
javaType- The Class object representing the desired Java typecolumnSqlType- The SQL type of the column, as defined in java.sql.Typesobj- The object to be converted- Returns:
- The converted object of the specified Java type
- Throws:
DatabricksSQLException- If there's an error during the conversion process
-
getConverterForSqlType
public static ObjectConverter getConverterForSqlType(int columnSqlType)
Retrieves the appropriate ObjectConverter for a given SQL type.- Parameters:
columnSqlType- The SQL type of the column, as defined in java.sql.Types- Returns:
- An ObjectConverter suitable for the specified SQL type
-
getConverterForColumnType
public static ObjectConverter getConverterForColumnType(int columnSqlType, String columnTypeName)
Retrieves the appropriate ObjectConverter for a given SQL type and column type name. This method provides metadata-aware converter selection, checking the actual column type name first for database-specific types before falling back to SQL type-based selection.- Parameters:
columnSqlType- The SQL type of the column, as defined in java.sql.TypescolumnTypeName- The actual column type name from metadata (e.g., "GEOMETRY", "GEOGRAPHY")- Returns:
- An ObjectConverter suitable for the specified column type
-
isConversionSupported
public static boolean isConversionSupported(int fromType, int toType)
-
-