Class LocklessLazyVar<T>

  • Direct Known Subclasses:
    LazyType, LazyTypeResolver

    public abstract class LocklessLazyVar<T>
    extends Object
    Implements the lazy initialization pattern. No locking of any kind is used.
    • Field Detail

      • NULL

        protected static final Object NULL
    • Constructor Detail

      • LocklessLazyVar

        public LocklessLazyVar()
    • Method Detail

      • get

        public final T get()
        Returns:
        the value of this lazy var, created if necessary
      • init

        protected abstract T init()
      • clear

        public final T clear()
        Clears the variable, forcing the next call to get() to re-calculate the value.
      • initDirectly

        protected void initDirectly​(T val)
      • isLoaded

        public boolean isLoaded()
      • make

        public static <Q> LocklessLazyVar<Q> make​(LocklessLazyVar.LazyVarInit<Q> closure)
        Creates a new LockingLazyVar based on the type of the LazyVarInit passed in. This method is intended to be called with a lambda or block from Gosu.