Class CachedSupplier<T>

java.lang.Object
de.msi.oauth.flow.common.CachedSupplier<T>
Type Parameters:
T - the type of the cached and supplied value
All Implemented Interfaces:
Supplier<T>

public abstract class CachedSupplier<T>
extends Object
implements Supplier<T>
This Supplier implementation uses a simple threadsafe caching functionality.
Author:
Martin Siegemund
  • Constructor Details

  • Method Details

    • get

      public final T get()
      Retrieve the cached value.

      If the value has not been cached already, getAndCache() gets invoked to retrieve the concrete value.

      Specified by:
      get in interface Supplier<T>
    • getAndCache

      protected abstract T getAndCache()
      Retrieve the concrete value which will get cached.
      Returns:
      the value