Package com.atlan.samples.loaders.models
Class DataTypeMapper
- java.lang.Object
-
- com.atlan.samples.loaders.models.DataTypeMapper
-
public class DataTypeMapper extends java.lang.Object
Utility class to convert data types for columns.
-
-
Constructor Summary
Constructors Constructor Description DataTypeMapper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getMappedType(java.lang.String type)
Retrieve the mapped data type for the provided type, or null if there is no mapped type (for spurious types).static java.lang.Long
getMaxLength(java.lang.String sqlType)
Retrieve the maximum length defined by the provided SQL type string.static java.lang.Integer
getPrecision(java.lang.String sqlType)
Retrieve the precision defined by the provided SQL type string.static java.lang.Double
getScale(java.lang.String sqlType)
Retrieve the scale defined by the provided SQL type string.static java.lang.String
getTypeOnly(java.lang.String sqlType)
Retrieve only the type name from the provided SQL type string.
-
-
-
Method Detail
-
getMappedType
public static java.lang.String getMappedType(java.lang.String type)
Retrieve the mapped data type for the provided type, or null if there is no mapped type (for spurious types).- Parameters:
type
- to map- Returns:
- the mapped data type
-
getTypeOnly
public static java.lang.String getTypeOnly(java.lang.String sqlType)
Retrieve only the type name from the provided SQL type string. Note: this will also uppercase the typename for case-insensitive comparison purposes.- Parameters:
sqlType
- from which to retrieve the type name- Returns:
- the type name (alone), or null if none could be found
-
getMaxLength
public static java.lang.Long getMaxLength(java.lang.String sqlType)
Retrieve the maximum length defined by the provided SQL type string.- Parameters:
sqlType
- from which to retrieve the maximum length- Returns:
- the maximum length, or null if none could be found
-
getPrecision
public static java.lang.Integer getPrecision(java.lang.String sqlType)
Retrieve the precision defined by the provided SQL type string.- Parameters:
sqlType
- from which to retrieve the precision- Returns:
- the precision, or null if none could be found
-
getScale
public static java.lang.Double getScale(java.lang.String sqlType)
Retrieve the scale defined by the provided SQL type string.- Parameters:
sqlType
- from which to retrieve the scale- Returns:
- the scale, or null if none could be found
-
-