org.pf.util
Class Association<K,V>

java.lang.Object
  extended by org.pf.util.Association<K,V>
All Implemented Interfaces:
java.io.Serializable, java.util.Map.Entry<K,V>
Direct Known Subclasses:
MapEntry, NamedValue

public class Association<K,V>
extends java.lang.Object
implements java.util.Map.Entry<K,V>, java.io.Serializable

Simple association of a key object and a value object.
Access to key and value is provided by

Version:
2.0
Author:
Manfred Duchrow
See Also:
Serialized Form

Constructor Summary
Association()
          Initialize the new instance with default values.
Association(K key, V value)
          Initialize the new instance with a key an a value.
 
Method Summary
 Association<K,V> copyAssociation()
          Returns a copy of this object
 boolean equals(java.lang.Object obj)
           
 K getKey()
           
 V getValue()
           
 int hashCode()
           
 K key()
          Returns the key of the association.
 void key(K newKey)
          Sets the key of the association.
 V setValue(V value)
           
 java.lang.String toString()
          Returns the toString() value of key and value separated by "->".
 V value()
          Returns the value of the association.
 void value(V newValue)
          Sets the value of the association.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Association

public Association()
Initialize the new instance with default values.


Association

public Association(K key,
                   V value)
Initialize the new instance with a key an a value.

Method Detail

equals

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

hashCode

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

key

public K key()
Returns the key of the association.


key

public void key(K newKey)
Sets the key of the association.


value

public V value()
Returns the value of the association.


value

public void value(V newValue)
Sets the value of the association.


toString

public java.lang.String toString()
Returns the toString() value of key and value separated by "->".

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getKey

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

getValue

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

setValue

public V setValue(V value)
Specified by:
setValue in interface java.util.Map.Entry<K,V>
See Also:
Map.Entry.setValue(java.lang.Object)

copyAssociation

public Association<K,V> copyAssociation()
Returns a copy of this object