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.
  • Constructor Details

  • Method Details

    • get

      public T 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:
      get in interface org.apache.commons.lang3.function.FailableSupplier<T,org.apache.commons.lang3.concurrent.ConcurrentException>
      Returns:
      the object initialized by this LazyInitializer
    • reset

      public void reset()
    • initialize

      protected T initialize()
      Creates and initializes the object managed by this LazyInitializer. This method is called by get() 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 by get().
      Returns:
      the managed data object