net.sf.molae.pipe.basic
Class AbstractMapEntry

java.lang.Object
  |
  +--net.sf.molae.pipe.basic.AbstractMapEntry
All Implemented Interfaces:
Map.Entry
Direct Known Subclasses:
DefaultMapEntry, ImmutableMapEntry, ListBackedMapEntry, MapBackedMapEntry, MapEntryProxy, ValueTransformedMapEntry

public abstract class AbstractMapEntry
extends Object
implements Map.Entry

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(Object 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.
 Object getKey()
          This implementation returns the content of the key property.
abstract  Object getValue()
           
 int hashCode()
          Is implemented as described in the comment to the Map.Entry.hashCode() method.
 Object setValue(Object 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(Object 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
Overrides:
equals in class Object

getKey

public Object getKey()
This implementation returns the content of the key property.
Specified by:
getKey in interface Map.Entry

getValue

public abstract Object getValue()
Specified by:
getValue in interface Map.Entry

hashCode

public int hashCode()
Is implemented as described in the comment to the Map.Entry.hashCode() method.
Specified by:
hashCode in interface Map.Entry
Overrides:
hashCode in class Object

setValue

public Object setValue(Object value)
This implementation always throws an UnsupportedOperationException.
Specified by:
setValue in interface Map.Entry
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