Class ReferenceMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
de.haumacher.msgbuf.util.ReferenceMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>

public abstract class ReferenceMap<K,V> extends HashMap<K,V>
Map implementing a map-valued property of a data object that has a reverse end.

The reverse end must be handled in concrete subclasses by overriding beforeAdd(Object, Object) and afterRemove(Object, Object).

See Also:
  • Constructor Details

    • ReferenceMap

      public ReferenceMap()
  • Method Details

    • put

      public V put(K key, V value)
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class HashMap<K,V>
    • putAll

      public void putAll(Map<? extends K,? extends V> collection)
      Specified by:
      putAll in interface Map<K,V>
      Overrides:
      putAll in class HashMap<K,V>
    • beforeAdd

      protected abstract void beforeAdd(K key, V value)
    • remove

      public V remove(Object key)
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class HashMap<K,V>
    • remove

      public boolean remove(Object key, Object value)
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class HashMap<K,V>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<K,V>
      Overrides:
      clear in class HashMap<K,V>
    • afterRemove

      protected abstract void afterRemove(K key, V value)