Class CachedValueSupplier<T>

  • All Implemented Interfaces:
    java.util.function.Supplier<T>

    class CachedValueSupplier<T>
    extends java.lang.Object
    implements java.util.function.Supplier<T>
    • Constructor Summary

      Constructors 
      Constructor Description
      CachedValueSupplier​(java.util.function.Supplier<T> calculateSupplier)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected T calculate()  
      T get()  
      void reset()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • calculateSupplier

        private final java.util.function.Supplier<T> calculateSupplier
      • calculated

        private boolean calculated
      • value

        @CheckForNull
        private T value
    • Constructor Detail

      • CachedValueSupplier

        public CachedValueSupplier​(java.util.function.Supplier<T> calculateSupplier)
    • Method Detail

      • get

        public final T get()
        Specified by:
        get in interface java.util.function.Supplier<T>
      • reset

        public final void reset()
      • calculate

        @CheckForNull
        protected final T calculate()