Package com.pugwoo.dbhelper.utils
Class TypeAutoCast
java.lang.Object
com.pugwoo.dbhelper.utils.TypeAutoCast
2015年8月22日 16:58:48
自动转换类型
- Author:
- pugwoo
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T自动转换类型static ObjectgetFromRS(ResultSet rs, String columnName, Field field, DatabaseTypeEnum databaseType) 从ResultSet中读出数据并转成成对应的类型,如果指定类型rs无法转换,则不转换。 2018年4月24日 11:48:32 新增支持标记为isJSON的列的处理。static StringtoSqlValueStr(Object object) 转换成sql值的字符串形式,带上单引号。 例如传入hello, 返回 'hello'static TypeAutoCast.BasicTypeResulttransBasicType(Class<?> clazz, ResultSet rs) 转换基本类型
-
Constructor Details
-
TypeAutoCast
public TypeAutoCast()
-
-
Method Details
-
getFromRS
public static Object getFromRS(ResultSet rs, String columnName, Field field, DatabaseTypeEnum databaseType) throws Exception 从ResultSet中读出数据并转成成对应的类型,如果指定类型rs无法转换,则不转换。 2018年4月24日 11:48:32 新增支持标记为isJSON的列的处理。- Throws:
Exception
-
transBasicType
public static TypeAutoCast.BasicTypeResult transBasicType(Class<?> clazz, ResultSet rs) throws Exception 转换基本类型- Throws:
Exception
-
cast
自动转换类型- Parameters:
obj- 要转换的对象clazz- 要转换成的类型
-
toSqlValueStr
转换成sql值的字符串形式,带上单引号。 例如传入hello, 返回 'hello'- Parameters:
object- 不应该为null,如果为null则返回空字符串''
-