Class OptionItem
- java.lang.Object
-
- org.fugerit.java.core.util.collection.OptionItem
-
- All Implemented Interfaces:
Serializable
,KeyObject<String>
public class OptionItem extends Object implements KeyObject<String>, Serializable
Object representing a key/value String set.
- Author:
- Fugerit
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<OptionItem>
LABEL_SORTER
Comparator to sort OptionItem by label String valuestatic Comparator<OptionItem>
VALUE_SORTER
Comparator to sort OptionItem by value String value
-
Constructor Summary
Constructors Constructor Description OptionItem(String valueAndLabel)
Creates a new OptionItem with the given label and value.OptionItem(String value, String label)
Creates a new OptionItem with the given label and value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getKey()
Returns the key of the objectString
getLabel()
Getter for the label propertyString
getValue()
Getter for the value propertyvoid
setLabel(String label)
Setter for the label propertyvoid
setValue(String value)
Setter for the value propertyvoid
setValueAndLabel(String valueAndLabel)
Set both the value and label of the OptionItemvoid
setValueAndLabel(String value, String label)
Set both the value and label of the OptionItem
-
-
-
Field Detail
-
LABEL_SORTER
public static final Comparator<OptionItem> LABEL_SORTER
Comparator to sort OptionItem by label String value
-
VALUE_SORTER
public static final Comparator<OptionItem> VALUE_SORTER
Comparator to sort OptionItem by value String value
-
-
Constructor Detail
-
OptionItem
public OptionItem(String value, String label)
Creates a new OptionItem with the given label and value.- Parameters:
value
- the valuelabel
- the label
-
OptionItem
public OptionItem(String valueAndLabel)
Creates a new OptionItem with the given label and value.- Parameters:
valueAndLabel
- both the label and value
-
-
Method Detail
-
getValue
public String getValue()
Getter for the value property- Returns:
- the value
-
setValue
public void setValue(String value)
Setter for the value property- Parameters:
value
- the value
-
getLabel
public String getLabel()
Getter for the label property- Returns:
- the label
-
setLabel
public void setLabel(String label)
Setter for the label property- Parameters:
label
- the label
-
setValueAndLabel
public void setValueAndLabel(String value, String label)
Set both the value and label of the OptionItem- Parameters:
value
- the valuelabel
- the label
-
setValueAndLabel
public void setValueAndLabel(String valueAndLabel)
Set both the value and label of the OptionItem- Parameters:
valueAndLabel
- both the label and value
-
-