Package de.msi.oauth.flow.common
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 Summary
Constructors Constructor Description CachedSupplier() -
Method Summary
Modifier and Type Method Description Tget()Retrieve the cached value.protected abstract TgetAndCache()Retrieve the concrete value which will get cached.
-
Constructor Details
-
CachedSupplier
public CachedSupplier()
-
-
Method Details
-
get
Retrieve the cached value.If the value has not been cached already,
getAndCache()gets invoked to retrieve the concrete value. -
getAndCache
Retrieve the concrete value which will get cached.- Returns:
- the value
-