Package org.axonframework.conversion
Class CachingSupplier<T>
java.lang.Object
org.axonframework.conversion.CachingSupplier<T>
- All Implemented Interfaces:
Supplier<T>
A Supplier that caches its result, useful if the supplier operation is expensive and expected to always yield the
same result. This supplier can be used concurrently by multiple threads.
- Author:
- Rene de Waele
-
Method Summary
Modifier and TypeMethodDescriptionget()static <T> CachingSupplier<T> Factory method for aCachingSupplierthat delegates to the givensupplierwhen asked to supply a value.static <T> CachingSupplier<T> of(T value) Factory method for aCachingSupplierthat will supply the givenvalue.
-
Method Details
-
of
Factory method for aCachingSupplierthat will supply the givenvalue.This factory method should be used when the value is already available. Used this way this supplier can be serialized.
- Type Parameters:
T- the type of results supplied by this supplier- Parameters:
value- the value to supply- Returns:
- a
CachingSupplierthat supplies the given value
-
of
Factory method for aCachingSupplierthat delegates to the givensupplierwhen asked to supply a value. If the givensupplieris aCachingSupplierthe instance is returned as is, if not a newCachingSupplierinstance is created.- Type Parameters:
T- the type of results supplied by this supplier- Parameters:
supplier- supplier for which to cache the result- Returns:
- a
CachingSupplierbased on givensupplier
-
get
-