Here you can find the source of getColumeTypeDesc(Class> clazz)
public static String getColumeTypeDesc(Class<?> clazz)
//package com.java2s; /*/*from w w w . j av a2 s. c o m*/ * Project: admin-parent * * File Created at 2014-04-03 * * Copyright 2012 Greenline.com Corporation Limited. * All rights reserved. * * This software is the confidential and proprietary information of * Greenline Company. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Greenline.com. */ import java.sql.Blob; import java.util.Date; public class Main { public static String getColumeTypeDesc(Class<?> clazz) { String result; if (clazz == boolean.class || clazz == Boolean.class) { result = "bit"; } else if (clazz == short.class || clazz == Short.class) { result = "smallint(4)"; } else if (clazz == int.class || clazz == Integer.class) { result = "int(11)"; } else if (clazz == long.class || clazz == Long.class) { result = "bigint(20)"; } else if (clazz == float.class || clazz == Float.class) { result = "float(10)"; } else if (clazz == double.class || clazz == Double.class) { result = "double(20)"; } else if (clazz == char.class || clazz == Character.class) { result = "char(1)"; } else if (clazz == char[].class || clazz == byte[].class || clazz == String.class) { result = "varchar(100)"; } else if (clazz == Date.class) { result = "datetime"; } else if (clazz == Blob.class) { result = "blob"; } else { result = null; } return result; } }