|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.KeyValue<K,V>
K - The class name of the key for this object.V - The class name of the value for this object.public class KeyValue<K,V>
A simple key-value class. This is useful in UI components when
you wish to tag along a unique identifier (eg. database primary
key, object ID etc.) with a display value. The
toString() method returns only value thus ensuring
that your display components function as normal, while giving
access to the unique identifier for control logic.
Copyright 2006 Sans Pareil Technologies, Inc.
| Constructor Summary | |
|---|---|
KeyValue()
Default constructor. |
|
KeyValue(K key,
V value)
Create a new instance using the specified values. |
|
| Method Summary | |
|---|---|
void |
addInformation(K key,
V value)
Add the specified key-value pair to information |
Object |
clone()
Creates and returns a copy of this object. |
int |
compareTo(KeyValue<K,V> object)
Compares this object with the specified object for order. |
boolean |
equals(Object object)
Compare the specified object for equality with this object. |
Map |
getInformation()
Returns information. |
K |
getKey()
Returns key. |
V |
getValue()
Returns value. |
int |
hashCode()
Return a hash code for this object. |
void |
setInformation(Map<K,V> information)
Set information. |
void |
setKey(K key)
Set key. |
void |
setValue(V value)
Set value. |
String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public KeyValue()
public KeyValue(K key,
V value)
key - The key to use.value - The value to use.| Method Detail |
|---|
public Object clone()
throws CloneNotSupportedException
Cloneable interface. No special actions are
performed. This method simply allows public access to the
Object.clone method.
clone in class ObjectCloneNotSupportedException - If the super-class implementation
throws an error.public int compareTo(KeyValue<K,V> object)
Note: The default implementation compares the
value or key or hashCode() values in that
order depending upon whether they implement Comparable or
not.
compareTo in interface Comparable<KeyValue<K,V>>object - The object that is to be compared with this object.
public boolean equals(Object object)
equals in class Objectobject - The object that is to be checked for equality.
true if the specified object
is of the same type and has the same key and
value values.public int hashCode()
hashCode in class Objectpublic String toString()
value.
toString in class Objectpublic K getKey()
key.
public void setKey(K key)
key.
key - The value to set.public V getValue()
value.
public void setValue(V value)
value.
value - The value to set.public Map getInformation()
information.
public void setInformation(Map<K,V> information)
information.
information - The value to set.
public void addInformation(K key,
V value)
key-value pair to information
key - The key for the mappingvalue - The value for the mapping.
|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||