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

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

public abstract class ForwardingMapEntry<K,V>
extends ForwardingObject
implements Map.Entry<K,V>

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

Author:
Mike Bostock
See Also:
ForwardingObject, Serialized Form

Constructor Summary
protected ForwardingMapEntry(Map.Entry<K,V> delegate)
           
 
Method Summary
protected  Map.Entry<K,V> delegate()
          Returns the backing delegate object.
 boolean equals(Object obj)
           
 K getKey()
           
 V getValue()
           
 int hashCode()
           
 V setValue(V value)
           
 
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
 

Constructor Detail

ForwardingMapEntry

protected ForwardingMapEntry(Map.Entry<K,V> delegate)
Method Detail

delegate

protected Map.Entry<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 ForwardingObject

getKey

public K getKey()
Specified by:
getKey in interface Map.Entry<K,V>

getValue

public V getValue()
Specified by:
getValue in interface Map.Entry<K,V>

setValue

public V setValue(V value)
Specified by:
setValue in interface Map.Entry<K,V>

equals

public boolean equals(Object obj)
Specified by:
equals in interface Map.Entry<K,V>
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Map.Entry<K,V>
Overrides:
hashCode in class Object