add sys props

This commit is contained in:
Looly
2022-03-22 10:16:06 +08:00
parent 37faf6d27b
commit 2ac275dd8f
4 changed files with 12 additions and 6 deletions

View File

@@ -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);
}

View File

@@ -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 -> {