Module storm

Class LazySupplier<T>

java.lang.Object
st.orm.template.impl.LazySupplier<T>
Type Parameters:
T - the type of results supplied by this supplier.
All Implemented Interfaces:
Supplier<T>

public final class LazySupplier<T> extends Object implements Supplier<T>
Returns a lazily initialized value.
  • Constructor Details

    • LazySupplier

      public LazySupplier(@Nonnull Supplier<T> supplier)
    • LazySupplier

      public LazySupplier(@Nonnull Supplier<T> supplier, @Nonnull T initialValue)
  • Method Details

    • lazy

      public static <T> Supplier<T> lazy(@Nonnull Supplier<T> supplier)
      Returns a supplier which lazy initializes the value.
      Type Parameters:
      T - the type of results supplied by this supplier.
      Parameters:
      supplier - the supplier that provides the value.
      Returns:
      a supplier which lazy initializes the value.
    • get

      public T get()
      Gets a result.
      Specified by:
      get in interface Supplier<T>
      Returns:
      a result
    • value

      public Optional<T> value()
      Returns the value if it has already been lazily loaded, otherwise an empty optional is returned.
      Returns:
      the value if it has already been lazily loaded, otherwise an empty optional.
    • remove

      public void remove()
      Removes the lazily loaded value. This will not remove the supplier.