Class ResetableLazyInitializer<T>
java.lang.Object
de.gematik.test.tiger.common.util.ResetableLazyInitializer<T>
- All Implemented Interfaces:
org.apache.commons.lang3.concurrent.ConcurrentInitializer<T>,org.apache.commons.lang3.function.FailableSupplier<T,org.apache.commons.lang3.concurrent.ConcurrentException>
public class ResetableLazyInitializer<T>
extends Object
implements org.apache.commons.lang3.concurrent.ConcurrentInitializer<T>
Basically the same as
LazyInitializer, but with a
reset method.-
Field Summary
Fields inherited from interface org.apache.commons.lang3.function.FailableSupplier
NUL -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ResetableLazyInitializer
-
-
Method Details
-
get
Returns the object wrapped by this instance. On first access the object is created. After that it is cached and can be accessed pretty fast.- Specified by:
getin interfaceorg.apache.commons.lang3.function.FailableSupplier<T,org.apache.commons.lang3.concurrent.ConcurrentException> - Returns:
- the object initialized by this
LazyInitializer
-
reset
public void reset() -
initialize
Creates and initializes the object managed by thisLazyInitializer. This method is called byget()when the object is accessed for the first time. An implementation can focus on the creation of the object. No synchronization is needed, as this is already handled byget().- Returns:
- the managed data object
-