我自己的数据对象处理类 ColumnType

阅读更多

package com.jh.core.db.jdbc;


final  class ColumnType {
 public final static int TYPE_OTHER = 0;

 public final static int TYPE_INTEGER = 1;

 public final static int TYPE_LONG = 2;

 public final static int TYPE_TIMESTAMP = 3;

 public final static int TYPE_STRING = 4;

 public final static int TYPE_DOUBLE = 5;

 public final static int TYPE_BIGDECIMAL = 6;

 public static int getType(String columnType) {
  int i = TYPE_OTHER;

  if ("java.lang.Integer".equals(columnType)) {
   return TYPE_INTEGER;
  }
  if ("java.lang.Long".equals(columnType)) {
   return TYPE_LONG;
  }
  if ("java.sql.Timestamp".equals(columnType)) {
   return TYPE_TIMESTAMP;
  }
  if ("java.lang.String".equals(columnType)) {
   return TYPE_STRING;
  }
  if ("java.lang.Double".equals(columnType)) {
   return TYPE_DOUBLE;
  }
  if ("java.math.BigDecimal".equals(columnType)) {
   return TYPE_BIGDECIMAL;
  }

  return i;

 }

}

你可能感兴趣的:(Java,SQL,JDBC)