Class RetainingInjector<T>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Value<T> getStoredValue()
      Get the value object stored in this injector.
      void inject​(T value)
      Inject the given value.
      protected Value<T> setStoredValue​(Value<T> value)
      Set the value object stored in this injector (must not be null).
      void uninject()
      Uninject the given value (in other words, cancel or undo a previous injection).
      • Methods inherited from class java.lang.Object

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

      • value

        private volatile Value<T> value
        The stored value.
      • valueUpdater

        private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<RetainingInjector,​Value> valueUpdater
    • Constructor Detail

      • RetainingInjector

        public RetainingInjector()
    • Method Detail

      • uninject

        public void uninject()
        Uninject the given value (in other words, cancel or undo a previous injection). Only called after inject() has been called.
        Specified by:
        uninject in interface Injector<T>
      • getStoredValue

        protected Value<T> getStoredValue()
        Get the value object stored in this injector.
        Returns:
        the value object
      • setStoredValue

        protected Value<T> setStoredValue​(Value<T> value)
        Set the value object stored in this injector (must not be null).
        Parameters:
        value - the value object (must not be null)
        Returns:
        the old value object, or null if none was stored