Class 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 Detail

      • delegate

        private final Supplier<T> delegate
      • computed

        private volatile T computed
    • Constructor Detail

      • Cached

        private Cached​(Supplier<T> delegate)
    • Method Detail

      • get

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