Java Utililty Methods SQL Type

List of utility methods to do SQL Type

Description

The list of methods to do SQL Type are organized into topic(s).

Method

booleanisPlainJdbcType(int type)
is Plain Jdbc Type
return type != Types.ARRAY && type != Types.BLOB && type != Types.CLOB && type != Types.DATALINK
        && type != Types.JAVA_OBJECT && type != Types.NCHAR && type != Types.NVARCHAR
        && type != Types.LONGNVARCHAR && type != Types.REF && type != Types.ROWID && type != Types.SQLXML;
booleanisPrecisionRequired(int jdbcType)
is Precision Required
switch (jdbcType) {
case Types.BIT:
case Types.BIGINT:
case Types.BOOLEAN:
case Types.INTEGER:
case Types.SMALLINT:
case Types.TINYINT:
case Types.FLOAT:
...
booleanisPrimitive(Class type)
is Primitive
return (type == Integer.class || type == Double.class || type == String.class || type == Date.class
        || type == Boolean.class || type == BigDecimal.class || type == Timestamp.class
        || type == Long.class);
booleanisPrimitiveCollection(Method m)
is Primitive Collection
if (!Collection.class.isAssignableFrom(m.getReturnType()))
    return false;
return isPrimitive(extractCollection(m));
booleanisScaleRequired(int type)
is Scale Required
switch (type) {
case java.sql.Types.DECIMAL:
case java.sql.Types.NUMERIC:
    return true;
default:
    return false;
booleanisSerializationClass(Class clazz)
is Serialization Class
return clazz.equals(Blob.class) || clazz.equals(InputStream.class);
booleanisSimpleType(Class type)
is Simple Type
for (Class<?> simpleType : SIMPLE_TYPES) {
    if (simpleType.equals(type))
        return true;
return false;
booleanisSqlTypeBinayBased(int javaSqlType)
Tells wether a column is binary like type or not.
return (javaSqlType == Types.BINARY) || (javaSqlType == Types.BLOB) || (javaSqlType == Types.VARBINARY)
        || (javaSqlType == Types.LONGVARBINARY);
booleanisSqlTypeSupported(int sqlType)
is Sql Type Supported
return sqlType != Types.REF_CURSOR && sqlType != Types.TIME_WITH_TIMEZONE
        && sqlType != Types.TIMESTAMP_WITH_TIMEZONE;
booleanisString(int colType)
Checks whether the given column type represents strings.
return (colType == Types.CHAR) || (colType == Types.CLOB) || (colType == Types.LONGNVARCHAR)
        || (colType == Types.LONGVARCHAR) || (colType == Types.NCHAR) || (colType == Types.NVARCHAR)
        || (colType == Types.VARCHAR);