Here you can find the source of getColumnClass(int sqlType)
Parameter | Description |
---|---|
sqlType | SQL Type. |
public static Class getColumnClass(int sqlType)
//package com.java2s; import java.sql.Types; public class Main { /**//from www . ja v a 2 s . c o m * This method return the Class of a specific SQL Type, defined in * java.sql.Types. * * @param sqlType * SQL Type. * @return The Class relative to the SQL Type. */ public static Class getColumnClass(int sqlType) { switch (sqlType) { case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: return String.class; case Types.BIT: case Types.BOOLEAN: return boolean.class; case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: return Integer.class; case Types.BIGINT: return Long.class; case Types.FLOAT: case Types.DOUBLE: case Types.DECIMAL: case Types.NUMERIC: case Types.REAL: return Double.class; case Types.DATE: return java.util.Date.class; case Types.TIMESTAMP: case Types.TIME: return java.sql.Timestamp.class; default: return Object.class; /* * types not recognized yet case Types.ARRAY : case Types.BINARY : case * Types.BLOB : case Types.CLOB : case Types.DATALINK : case * Types.DISTINCT : case Types.JAVA_OBJECT : case Types.LONGVARBINARY : * case Types.NULL : case Types.OTHER : case Types.REF : case * Types.STRUCT : case Types.VARBINARY : */ } } }