mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-05 21:28:00 +08:00
add LazyFuncLoader
This commit is contained in:
parent
d35dce9478
commit
3bd816471c
@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# 5.6.1 (2021-03-14)
|
# 5.6.1 (2021-03-16)
|
||||||
|
|
||||||
### 新特性
|
### 新特性
|
||||||
* 【crypto 】 SecureUtil去除final修饰符(issue#1474@Github)
|
* 【crypto 】 SecureUtil去除final修饰符(issue#1474@Github)
|
||||||
* 【core 】 IoUtil增加lineIter方法
|
* 【core 】 IoUtil增加lineIter方法
|
||||||
|
* 【core 】 新增函数式懒加载加载器(pr#275@Gitee)
|
||||||
|
|
||||||
### Bug修复
|
### Bug修复
|
||||||
* 【core 】 修复IoUtil.readBytes的FileInputStream中isClose参数失效问题(issue#I3B7UD@Gitee)
|
* 【core 】 修复IoUtil.readBytes的FileInputStream中isClose参数失效问题(issue#I3B7UD@Gitee)
|
||||||
|
@ -14,8 +14,10 @@ import java.util.function.Supplier;
|
|||||||
* @param <T> 被加载对象类型
|
* @param <T> 被加载对象类型
|
||||||
* @author Mr.Po
|
* @author Mr.Po
|
||||||
* @see cn.hutool.core.lang.loader.LazyLoader
|
* @see cn.hutool.core.lang.loader.LazyLoader
|
||||||
|
* @since 5.6.1
|
||||||
*/
|
*/
|
||||||
public final class LazyFunLoader<T> extends LazyLoader<T> {
|
public class LazyFunLoader<T> extends LazyLoader<T> {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用于生成对象的函数
|
* 用于生成对象的函数
|
||||||
@ -34,10 +36,8 @@ public final class LazyFunLoader<T> extends LazyLoader<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected T init() {
|
protected T init() {
|
||||||
|
|
||||||
T t = this.supplier.get();
|
T t = this.supplier.get();
|
||||||
this.supplier = null;
|
this.supplier = null;
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,6 @@ public final class LazyFunLoader<T> extends LazyLoader<T> {
|
|||||||
* @param consumer 待执行函数
|
* @param consumer 待执行函数
|
||||||
*/
|
*/
|
||||||
public void ifInitialized(Consumer<T> consumer) {
|
public void ifInitialized(Consumer<T> consumer) {
|
||||||
|
|
||||||
Assert.notNull(consumer);
|
Assert.notNull(consumer);
|
||||||
|
|
||||||
// 已经初始化
|
// 已经初始化
|
||||||
|
Loading…
Reference in New Issue
Block a user