com.google.common.collect
Class ForwardingConcurrentMap<K,V>

java.lang.Object
  extended by com.google.common.collect.ForwardingObject
      extended by com.google.common.collect.ForwardingMap<K,V>
          extended by com.google.common.collect.ForwardingConcurrentMap<K,V>
All Implemented Interfaces:
Serializable, ConcurrentMap<K,V>, Map<K,V>

public abstract class ForwardingConcurrentMap<K,V>
extends ForwardingMap<K,V>
implements ConcurrentMap<K,V>

A concurrent map which forwards all its method calls to another concurrent map. Subclasses should override one or more methods to modify the behavior of the backing map as desired per the decorator pattern.

Author:
Charles Fry
See Also:
ForwardingObject, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
protected ForwardingConcurrentMap(ConcurrentMap<K,V> delegate)
          Constructs a forwarding concurrent map that forwards to the provided delegate.
 
Method Summary
protected  ConcurrentMap<K,V> delegate()
          Returns the backing delegate object.
 V putIfAbsent(K key, V value)
           
 boolean remove(Object key, Object value)
           
 V replace(K key, V value)
           
 boolean replace(K key, V oldValue, V newValue)
           
 
Methods inherited from class com.google.common.collect.ForwardingMap
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class com.google.common.collect.ForwardingObject
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

ForwardingConcurrentMap

protected ForwardingConcurrentMap(ConcurrentMap<K,V> delegate)
Constructs a forwarding concurrent map that forwards to the provided delegate.

Method Detail

delegate

protected ConcurrentMap<K,V> delegate()
Description copied from class: ForwardingObject
Returns the backing delegate object. This method should be overridden to specify the correct return type. For example:
  @SuppressWarnings("unchecked")
  @Override protected Foo delegate() {
    return (Foo) super.delegate();
  }
This method should always return the same delegate instance that was passed to the constructor.

Overrides:
delegate in class ForwardingMap<K,V>

putIfAbsent

public V putIfAbsent(K key,
                     V value)
Specified by:
putIfAbsent in interface ConcurrentMap<K,V>

remove

public boolean remove(Object key,
                      Object value)
Specified by:
remove in interface ConcurrentMap<K,V>

replace

public V replace(K key,
                 V value)
Specified by:
replace in interface ConcurrentMap<K,V>

replace

public boolean replace(K key,
                       V oldValue,
                       V newValue)
Specified by:
replace in interface ConcurrentMap<K,V>