Here you can find the source of getObject(int sqlType, String value)
Parameter | Description |
---|---|
sqlType | a parameter |
value | a parameter |
public static Object getObject(int sqlType, String value)
//package com.java2s; import java.sql.Types; public class Main { /**//from w ww . j ava 2 s. com * get the value through different object . * * @param sqlType * @param value * @return */ public static Object getObject(int sqlType, String value) { if (value == null || value.equalsIgnoreCase("null")) { return null; } if (sqlType == Types.CHAR) { return value; } else if (sqlType == Types.VARCHAR) { return value; } else if (sqlType == Types.BIT) { return value; } else if (sqlType == Types.INTEGER) { return new Integer(value); } else if (sqlType == Types.NUMERIC) { return new Double(value); } else if (sqlType == Types.FLOAT) { return new Float(value); } else if (sqlType == Types.DOUBLE) { return new Double(value); } else if (sqlType == Types.SMALLINT) { return new Short(value); } else if (sqlType == Types.DATE) { return value; } else if (sqlType == Types.TIME) { return value; } else if (sqlType == Types.TIMESTAMP) { return value; } else if (sqlType == Types.ARRAY) { return value; } else if (sqlType == Types.NULL) { return null; } else { return value; } } }