public class ResultSetUtil extends Object
| 构造器和说明 |
|---|
ResultSetUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static List<Object> |
handleRowToList(ResultSet rs)
处理单行数据
|
static <T> T |
toBean(int columnCount,
ResultSetMetaData meta,
ResultSet rs,
Class<T> beanClass)
处理单条数据
|
static <T> T |
toBean(int columnCount,
ResultSetMetaData meta,
ResultSet rs,
T bean)
处理单条数据
|
static <E,T extends Collection<E>> |
toBeanList(ResultSet rs,
T collection,
Class<E> elementBeanType)
处理多条数据并返回一个Bean列表
|
static Entity |
toEntity(int columnCount,
ResultSetMetaData meta,
ResultSet rs)
处理单条数据
|
static Entity |
toEntity(int columnCount,
ResultSetMetaData meta,
ResultSet rs,
boolean caseInsensitive)
处理单条数据
|
static Entity |
toEntity(ResultSet rs)
处理单条数据
|
static <T extends Entity> |
toEntity(T row,
int columnCount,
ResultSetMetaData meta,
ResultSet rs,
boolean withMetaInfo)
处理单条数据
|
static <T extends Collection<Entity>> |
toEntityList(ResultSet rs,
T collection)
处理多条数据
|
static <T extends Collection<Entity>> |
toEntityList(ResultSet rs,
T collection,
boolean caseInsensitive)
处理多条数据
|
static Long |
toLong(ResultSet rs)
结果集读取为一个Long值,一版用于插入时返回主键等
当有多个值返回时,只取第一个 |
public static <T> T toBean(int columnCount,
ResultSetMetaData meta,
ResultSet rs,
T bean)
throws SQLException
T - Bean类型columnCount - 列数meta - ResultSetMetaDatars - 数据集bean - 目标BeanSQLException - SQL执行异常public static <T> T toBean(int columnCount,
ResultSetMetaData meta,
ResultSet rs,
Class<T> beanClass)
throws SQLException
T - Bean类型columnCount - 列数meta - ResultSetMetaDatars - 数据集beanClass - 目标Bean类型SQLException - SQL执行异常public static Entity toEntity(int columnCount, ResultSetMetaData meta, ResultSet rs) throws SQLException
columnCount - 列数meta - ResultSetMetaDatars - 数据集SQLException - SQL执行异常public static Entity toEntity(int columnCount, ResultSetMetaData meta, ResultSet rs, boolean caseInsensitive) throws SQLException
columnCount - 列数meta - ResultSetMetaDatars - 数据集caseInsensitive - 是否大小写不敏感SQLException - SQL执行异常public static <T extends Entity> T toEntity(T row, int columnCount, ResultSetMetaData meta, ResultSet rs, boolean withMetaInfo) throws SQLException
T - Entity及其子对象row - Entity对象columnCount - 列数meta - ResultSetMetaDatars - 数据集withMetaInfo - 是否包含表名、字段名等元信息SQLException - SQL执行异常public static Entity toEntity(ResultSet rs) throws SQLException
rs - 数据集SQLException - SQL执行异常public static List<Object> handleRowToList(ResultSet rs) throws SQLException
rs - 数据集(行)SQLException - SQL执行异常public static <T extends Collection<Entity>> T toEntityList(ResultSet rs, T collection) throws SQLException
T - 集合类型rs - 数据集collection - 数据集SQLException - SQL执行异常public static <T extends Collection<Entity>> T toEntityList(ResultSet rs, T collection, boolean caseInsensitive) throws SQLException
T - 集合类型rs - 数据集collection - 数据集caseInsensitive - 是否大小写不敏感SQLException - SQL执行异常public static <E,T extends Collection<E>> T toBeanList(ResultSet rs, T collection, Class<E> elementBeanType) throws SQLException
E - 集合元素类型T - 集合类型rs - 数据集collection - 数据集elementBeanType - Bean类型SQLException - SQL执行异常public static Long toLong(ResultSet rs) throws SQLException
rs - 数据集SQLException - SQL执行异常Copyright © 2023. All rights reserved.