Package org.jdbi.v3.core.internal
Class MemoizingSupplier<T>
- java.lang.Object
-
- org.jdbi.v3.core.internal.MemoizingSupplier<T>
-
- Type Parameters:
T- The type of the object returned by this supplier.
- All Implemented Interfaces:
java.util.function.Supplier<T>
public class MemoizingSupplier<T> extends java.lang.Object implements java.util.function.Supplier<T>Wraps a supplier and memoizes the object returned.- See Also:
Supplier
-
-
Constructor Summary
Constructors Modifier Constructor Description privateMemoizingSupplier(java.util.function.Supplier<T> create)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget()voidifInitialized(java.util.function.Consumer<T> consumer)Execute a method on the object returned from the supplier if the object was already created.private Tinit()private TinternalGet()static <T> MemoizingSupplier<T>of(java.util.function.Supplier<T> supplier)
-
-
-
Constructor Detail
-
MemoizingSupplier
private MemoizingSupplier(java.util.function.Supplier<T> create)
-
-
Method Detail
-
of
public static <T> MemoizingSupplier<T> of(java.util.function.Supplier<T> supplier)
-
internalGet
private T internalGet()
-
ifInitialized
public void ifInitialized(java.util.function.Consumer<T> consumer)
Execute a method on the object returned from the supplier if the object was already created. Skips execution if the underlying object was never created.- Parameters:
consumer- A consumer for the object returned by this supplier.
-
init
private T init()
-
-