Class MapInjector<K,​T>

  • Type Parameters:
    K - the key type
    T - the value type
    All Implemented Interfaces:
    Injector<T>

    public final class MapInjector<K,​T>
    extends java.lang.Object
    implements Injector<T>
    An injector which applies a value to a map entry.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private K key  
      private java.util.Map<K,​T> map  
    • Constructor Summary

      Constructors 
      Constructor Description
      MapInjector​(java.util.Map<K,​T> map, K key)
      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

      • map

        private final java.util.Map<K,​T> map
      • key

        private final K key
    • Constructor Detail

      • MapInjector

        public MapInjector​(java.util.Map<K,​T> map,
                           K key)
        Construct a new instance.
        Parameters:
        map - the map to update
        key - the key for this injector
    • 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<K>