-
- Type Parameters:
T
- the type of the value
- All Superinterfaces:
Comparable<Item<T>>
,Serializable
public interface Item<T> extends Comparable<Item<T>>, Serializable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description String
caption()
static <T> Item<T>
item(T value)
Returns anItem
, with the caption as item.toString() or an empty string in case of a null valuestatic <T> Item<T>
item(T value, String caption)
Creates a newItem
.static <T> Item<T>
itemI18n(T value, String resourceBundleName, String resourceBundleKey)
Creates a newItem
, which gets its caption from a resource bundle.T
value()
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
caption
String caption()
- Returns:
- the caption
-
value
T value()
- Returns:
- the value
-
item
static <T> Item<T> item(T value)
Returns anItem
, with the caption as item.toString() or an empty string in case of a null value- Type Parameters:
T
- the value type- Parameters:
value
- the value, may be null- Returns:
- an
Item
based on the given value
-
item
static <T> Item<T> item(T value, String caption)
Creates a newItem
.- Type Parameters:
T
- the value type- Parameters:
value
- the value, may be nullcaption
- the caption- Returns:
- an
Item
based on the given value and caption - Throws:
NullPointerException
- if caption is null
-
itemI18n
static <T> Item<T> itemI18n(T value, String resourceBundleName, String resourceBundleKey)
Creates a newItem
, which gets its caption from a resource bundle. Note that the caption is cached, so that changing theLocale
after the first timecaption()
is called will not change the caption.- Type Parameters:
T
- the value type- Parameters:
value
- the value, may be nullresourceBundleName
- the resource bundle nameresourceBundleKey
- the resource bundle key for the item caption- Returns:
- an Item based on the given value and resource bundle
-
-