net.sf.japaki.beans
Class KeyValuePair<K,V>

java.lang.Object
  extended by net.sf.japaki.beans.KeyValuePair<K,V>
All Implemented Interfaces:
Map.Entry<K,V>, KeyValueBean<K,V>

public class KeyValuePair<K,V>
extends Object
implements KeyValueBean<K,V>

A bean with two properties.


Constructor Summary
KeyValuePair()
           
 
Method Summary
 boolean equals(Object obj)
           
 K getKey()
           
static
<K> Property<KeyValueBean<K,?>,K>
getKeyProperty()
          Returns the property to the key of this bean.
 V getValue()
           
static
<V> Property<Map.Entry<?,V>,V>
getValueProperty()
          Returns the property to the value of this bean.
 int hashCode()
           
static
<K,V> KeyValuePair<K,V>
newInstance(K key, V value)
          Creates a new key value pair
 K setKey(K key)
          Replaces the key corresponding to this bean with the specified key.
 V setValue(V value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyValuePair

public KeyValuePair()
Method Detail

newInstance

public static <K,V> KeyValuePair<K,V> newInstance(K key,
                                                  V value)
Creates a new key value pair

Parameters:
key - initial value of the key property
value - initial value of the value property

getKey

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

setKey

public K setKey(K key)
Description copied from interface: KeyValueBean
Replaces the key corresponding to this bean with the specified key.

Specified by:
setKey in interface KeyValueBean<K,V>
Parameters:
key - new key to be stored in this bean

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>

hashCode

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

equals

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

toString

public String toString()
Overrides:
toString in class Object

getKeyProperty

public static final <K> Property<KeyValueBean<K,?>,K> getKeyProperty()
Returns the property to the key of this bean.

Returns:
the property to the key of this bean

getValueProperty

public static final <V> Property<Map.Entry<?,V>,V> getValueProperty()
Returns the property to the value of this bean.

Returns:
the property to the value of this bean