Class Lazy<T,E extends Throwable>

java.lang.Object
de.thomas_oster.lazysql.Lazy<T,E>
Type Parameters:
T -
E -

public class Lazy<T,E extends Throwable> extends Object
Class for a Thread-Safe LazyEvaluated supplier which can throw exceptions
Author:
Thomas Oster (thomas.oster@upstart-it.de)
  • Constructor Details

  • Method Details

    • of

      public static <T, E extends Throwable> Lazy<T,E> of(Lazy.Supplier<T,E> s)
    • get

      public T get() throws E
      Calculates the value and caches the result if no Exception occurs. After that only the cached result is returned until the reset method is called (even if the value was null)
      Returns:
      the value calculated, even null
      Throws:
      E - an exception if the supplier method throws one
    • getValue

      public T getValue() throws E
      Alias for get() for supporting JavaBean Style
      Returns:
      Throws:
      E
    • reset

      public void reset()