mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add sys props
This commit is contained in:
@@ -29,9 +29,10 @@ public class LazyFunLoader<T> extends LazyLoader<T> {
|
||||
* @param supplier 用于生成对象的函数
|
||||
* @param <T> 对象类型
|
||||
* @return 函数式懒加载加载器对象
|
||||
* @since 5.8.0
|
||||
*/
|
||||
public static <T> LazyFunLoader<T> onLoad(final Supplier<T> supplier) {
|
||||
Assert.notNull(supplier, "supplier");
|
||||
public static <T> LazyFunLoader<T> on(final Supplier<T> supplier) {
|
||||
Assert.notNull(supplier, "supplier must be not null!");
|
||||
return new LazyFunLoader<>(supplier);
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ public class LazyFunLoaderTest {
|
||||
@Test
|
||||
public void testOnLoadStaticFactoryMethod1() {
|
||||
|
||||
LazyFunLoader<BigObject> loader = LazyFunLoader.onLoad(BigObject::new);
|
||||
LazyFunLoader<BigObject> loader = LazyFunLoader.on(BigObject::new);
|
||||
|
||||
Assert.assertNotNull(loader.get());
|
||||
Assert.assertTrue(loader.isInitialize());
|
||||
@@ -60,7 +60,7 @@ public class LazyFunLoaderTest {
|
||||
@Test
|
||||
public void testOnLoadStaticFactoryMethod2() {
|
||||
|
||||
LazyFunLoader<BigObject> loader = LazyFunLoader.onLoad(BigObject::new);
|
||||
LazyFunLoader<BigObject> loader = LazyFunLoader.on(BigObject::new);
|
||||
|
||||
// 若从未使用,则可以避免不必要的初始化
|
||||
loader.ifInitialized(it -> {
|
||||
|
Reference in New Issue
Block a user