net.sf.molae.pipe.basic
Class AbstractMapEntry<K,V>

java.lang.Object
  extended by net.sf.molae.pipe.basic.AbstractMapEntry<K,V>
All Implemented Interfaces:
Map.Entry<K,V>
Direct Known Subclasses:
DefaultMapEntry, ImmutableMapEntry, ListBackedMapEntry, MapBackedMapEntry, MapEntryProxy, ValueTransformedMapEntry

public abstract class AbstractMapEntry<K,V>
extends Object
implements Map.Entry<K,V>

This class provides a skeletal implementation of the Map.Entry interface, to minimize the effort required to implement this interface. It contains a property to store the key of the map entry. To implement an unmodifiable map, only getValue() has to be implemented. To implement a modifiable map, setValue(Object) must additionally be specified.


Constructor Summary
protected AbstractMapEntry(K pKey)
          Constructs a new AbstractMapEntry object.
 
Method Summary
 boolean equals(Object o)
          Is implemented as described in the comment to the Map.Entry.equals(Object) method.
 K getKey()
          This implementation returns the content of the key property.
abstract  V getValue()
           
 int hashCode()
          Is implemented as described in the comment to the Map.Entry.hashCode() method.
 V setValue(V value)
          This implementation always throws an UnsupportedOperationException.
 String toString()
          Returns the content of this map entry in format key=value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMapEntry

protected AbstractMapEntry(K pKey)
Constructs a new AbstractMapEntry object. Called by child classes to set the key of this entry.

Parameters:
pKey - the key corresponding to this entry.
Method Detail

equals

public boolean equals(Object o)
Is implemented as described in the comment to the Map.Entry.equals(Object) method.

Specified by:
equals in interface Map.Entry<K,V>
Overrides:
equals in class Object

getKey

public K getKey()
This implementation returns the content of the key property.

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

getValue

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

hashCode

public int hashCode()
Is implemented as described in the comment to the Map.Entry.hashCode() method.

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

setValue

public V setValue(V value)
This implementation always throws an UnsupportedOperationException.

Specified by:
setValue in interface Map.Entry<K,V>
Throws:
UnsupportedOperationException - always
See Also:
getValue()

toString

public String toString()
Returns the content of this map entry in format key=value.

Overrides:
toString in class Object
Returns:
The content of this map entry in format key=value