Package org.apache.struts.util
Class LabelValueBean
java.lang.Object
org.apache.struts.util.LabelValueBean
- All Implemented Interfaces:
Serializable
,Comparable<LabelValueBean>
A simple JavaBean to represent label-value pairs. This is most commonly
used when constructing user interface elements which have a label to be
displayed to the user, and a corresponding value to be returned to the
server. One example is the
<html:options>
tag.
Note: this class has a natural ordering that is inconsistent with equals.
- Version:
- $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005) $
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Comparator
<LabelValueBean> Comparator that can be used for a case insensitive sort ofLabelValueBean
objects. -
Constructor Summary
ConstructorDescriptionDefault constructor.LabelValueBean
(String label, String value) Construct an instance with the supplied property values. -
Method Summary
Modifier and TypeMethodDescriptionint
Compare LabelValueBeans based on the label, because that's the human viewable part of the object.boolean
LabelValueBeans are equal if their values are both null or equal.getLabel()
getValue()
int
hashCode()
The hash code is based on the object's value.void
void
toString()
Return a string representation of this object.
-
Field Details
-
CASE_INSENSITIVE_ORDER
Comparator that can be used for a case insensitive sort ofLabelValueBean
objects.
-
-
Constructor Details
-
LabelValueBean
public LabelValueBean()Default constructor. -
LabelValueBean
Construct an instance with the supplied property values.- Parameters:
label
- The label to be displayed to the user.value
- The value to be returned to the server.
-
-
Method Details
-
getLabel
-
setLabel
-
getValue
-
setValue
-
compareTo
Compare LabelValueBeans based on the label, because that's the human viewable part of the object.- Specified by:
compareTo
in interfaceComparable<LabelValueBean>
- See Also:
-
toString
Return a string representation of this object. -
equals
LabelValueBeans are equal if their values are both null or equal. -
hashCode
public int hashCode()The hash code is based on the object's value.
-