Class MappedQuery.Default<T>
java.lang.Object
org.huiche.jdbc.MappedQuery.Default<T>
- Type Parameters:
T- 类型
- All Implemented Interfaces:
MappedQuery<T>
- Enclosing interface:
MappedQuery<T>
MappedQuery默认实现
-
Nested Class Summary
Nested classes/interfaces inherited from interface MappedQuery
MappedQuery.Default<T> -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MappedQuery
first, list, set, stream
-
Method Details
-
collection
Description copied from interface:MappedQuery查询为集合- Specified by:
collectionin interfaceMappedQuery<T>- Type Parameters:
C- 集合类型- Parameters:
collection- 集合- Returns:
- 结果(实际为传入的结合对象,填充了结果)
-
first
Description copied from interface:MappedQuery查询第一条数据,自行确保sql查询结果为一条记录无结果行或第一行的值为
null时返回defaultValue; 若defaultValue也为null,则按类型返回兜底值: 基本类型返回类型默认值,集合/Map/数组返回空对象.- Specified by:
firstin interfaceMappedQuery<T>- Parameters:
defaultValue- 默认值- Returns:
- 结果
-
list
Description copied from interface:MappedQuery查询为list- Specified by:
listin interfaceMappedQuery<T>- Returns:
- 结果
-
optional
Description copied from interface:MappedQuery查询为optional无结果行,或第一行的值为
null时返回Optional.empty().- Specified by:
optionalin interfaceMappedQuery<T>- Returns:
- 结果
-
set
Description copied from interface:MappedQuery查询为set,默认使用LikedHashSet实现,保留原顺序- Specified by:
setin interfaceMappedQuery<T>- Returns:
- 结果
-
stream
Description copied from interface:MappedQuery查询为stream结果集读尽或遍历异常时会自动释放连接;短路操作(
limit/findFirst/anyMatch等) 不会读尽结果集,必须使用 try-with-resources 或显式 close 释放连接。- Specified by:
streamin interfaceMappedQuery<T>- Parameters:
estimatedSize- 预估条数, 仅作为 stream 的 estimateSize 提示值- Returns:
- 结果
-