Class JsonProviderImpl.Cached<T>

  • Type Parameters:
    T - the type of the cached instance.
    All Implemented Interfaces:
    java.util.function.Supplier<T>
    Enclosing class:
    JsonProviderImpl

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

      Fields 
      Modifier and Type Field Description
      private T computed  
      private java.util.function.Supplier<T> delegate  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Cached​(java.util.function.Supplier<T> delegate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • delegate

        private final java.util.function.Supplier<T> delegate
      • computed

        private volatile T computed
    • Constructor Detail

      • Cached

        private Cached​(java.util.function.Supplier<T> delegate)
    • Method Detail

      • get

        public T get()
        Specified by:
        get in interface java.util.function.Supplier<T>