Class JsonProviderImpl.Cached<T>

java.lang.Object
org.apache.johnzon.core.JsonProviderImpl.Cached<T>
Type Parameters:
T - the type of the cached instance.
All Implemented Interfaces:
Supplier<T>
Enclosing class:
JsonProviderImpl

private static class JsonProviderImpl.Cached<T> extends Object implements Supplier<T>
Enables to not allocate potentially big instances or delay the initialization but ensure it happens only once.
  • Field Details

    • delegate

      private final Supplier<T> delegate
    • computed

      private volatile T computed
  • Constructor Details

    • Cached

      private Cached(Supplier<T> delegate)
  • Method Details

    • get

      public T get()
      Specified by:
      get in interface Supplier<T>