Package de.sciss.gui
Class StringItem
- java.lang.Object
-
- de.sciss.gui.StringItem
-
public class StringItem extends java.lang.ObjectA simple structure encompassing a string and an associated value. While the string is usually used as an internal, locale-independant lookup key, the object is usually something that gets presented to the user on the GUI.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.ComparatorkeyComparatorstatic java.util.ComparatorvalueComparator
-
Constructor Summary
Constructors Constructor Description StringItem(java.lang.String key, java.lang.Object value)Constructs a new immutable StringItem.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Compares this object to another objectjava.lang.StringgetKey()Queries the key.java.lang.ObjectgetValue()Queries the value object.inthashCode()java.lang.StringtoString()Returns a string representation of the value.
-
-
-
Method Detail
-
getKey
public java.lang.String getKey()
Queries the key.- Returns:
- the key string which was used to construct the item
-
getValue
public java.lang.Object getValue()
Queries the value object.- Returns:
- the value object which was used to construct the item
-
equals
public boolean equals(java.lang.Object o)
Compares this object to another object- Overrides:
equalsin classjava.lang.Object- Parameters:
o- an object which shall be compared to the StringItem- Returns:
true, if the provided object is a StringItem whose key and value match this item's key and value (using their respectiveequalsmethods)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of the value. This is essential, since it allows us to add StringItems directly to ComboBoxes and the like whise call this method to get a GUI representation text.- Overrides:
toStringin classjava.lang.Object- Returns:
- basically
value.toString()
-
-