Class AtomicReferenceFieldUpdaterInjector<C,​T>

  • Type Parameters:
    C - the class which holds the target field
    T - the type of the value to inject
    All Implemented Interfaces:
    Injector<T>

    public final class AtomicReferenceFieldUpdaterInjector<C,​T>
    extends java.lang.Object
    implements Injector<T>
    An injector which updates the value of an AtomicReferenceFieldUpdater.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Value<C> target  
      private java.util.concurrent.atomic.AtomicReferenceFieldUpdater<C,​? super T> updater  
    • Constructor Summary

      Constructors 
      Constructor Description
      AtomicReferenceFieldUpdaterInjector​(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<C,​? super T> updater, Value<C> target)
      Construct a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void inject​(T value)
      Inject the given value.
      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

      • updater

        private final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<C,​? super T> updater
      • target

        private final Value<C> target
    • Constructor Detail

      • AtomicReferenceFieldUpdaterInjector

        public AtomicReferenceFieldUpdaterInjector​(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<C,​? super T> updater,
                                                   Value<C> target)
        Construct a new instance.
        Parameters:
        updater - the updater to inject to
        target - the target object upon which to inject
    • Method Detail

      • inject

        public void inject​(T value)
        Inject the given value.
        Specified by:
        inject in interface Injector<C>
        Parameters:
        value - the value
      • 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<C>