Class LazyClosure<T extends Serializable>

java.lang.Object
overit.geocall.util.LazyClosure<T>
All Implemented Interfaces:
Serializable

public class LazyClosure<T extends Serializable> extends Object implements Serializable
LazyClosure is a simple in-memory caching class. The LazyClosure class suits the caching of database calls, complex object graph building routines and web service calls that should be cached for performance. It defers from Lazy by the default value, in case the Lazy supplier is null.
See Also:
  • Field Details

  • Constructor Details

    • LazyClosure

      public LazyClosure(Lazy.SerializableSupplier<T> supplier, T def)
      Creates a LazyClosure object with the defined Lazy.
      Parameters:
      supplier - The Lazy supplier.
      def - Default value to return.
  • Method Details

    • get

      public final T get()
      Returns the value retrieved from the lazy supplier. If the value retrieved from the lazy supplier is null, returns the default value.
      Returns:
      The value retrieved from the lazy supplier. If the value retrieved from the lazy supplier is null, returns the default value.