org.jminor.common.model
Class Item<T>

java.lang.Object
  extended by org.jminor.common.model.Item<T>
Type Parameters:
T - the type of the actual item
All Implemented Interfaces:
Serializable, Comparable<Item<T>>
Direct Known Subclasses:
ItemComboBoxModel.IconItem

public class Item<T>
extends Object
implements Comparable<Item<T>>, Serializable

A class encapsulating an item and caption.

See Also:
Serialized Form

Constructor Summary
Item(T item, String caption)
          Instantiates a new Item.
 
Method Summary
 int compareTo(Item<T> o)
          Compares this item with the given item according to the caption.
 boolean equals(Object obj)
          
 String getCaption()
           
 T getItem()
           
 int hashCode()
          
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Item

public Item(T item,
            String caption)
Instantiates a new Item.

Parameters:
item - the item
caption - the caption
Method Detail

getCaption

public final String getCaption()
Returns:
the caption

getItem

public final T getItem()
Returns:
the actual item

toString

public final String toString()
Overrides:
toString in class Object
Returns:
the item caption

equals

public final boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public final int hashCode()

Overrides:
hashCode in class Object

compareTo

public final int compareTo(Item<T> o)
Compares this item with the given item according to the caption.

Specified by:
compareTo in interface Comparable<Item<T>>
Parameters:
o - the item to compare with
Returns:
the compare result