gov.nih.nci.caarray.util
Class LabelValue

java.lang.Object
  extended by gov.nih.nci.caarray.util.LabelValue
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class LabelValue
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

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.

See Also:
org.apache.struts.util.LabelValueBean, Serialized Form

Field Summary
static java.util.Comparator CASE_INSENSITIVE_ORDER
          Comparator that can be used for a case insensitive sort of LabelValue objects.
 
Constructor Summary
LabelValue()
          Default constructor.
LabelValue(java.lang.String label, java.lang.String value)
          Construct an instance with the supplied property values.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compare LabelValueBeans based on the label, because that's the human viewable part of the object.
 java.lang.String getLabel()
          get label.
 java.lang.String getValue()
          get value.
 void setLabel(java.lang.String label)
          set label.
 void setValue(java.lang.String value)
          set value.
 java.lang.String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CASE_INSENSITIVE_ORDER

public static final java.util.Comparator CASE_INSENSITIVE_ORDER
Comparator that can be used for a case insensitive sort of LabelValue objects.

Constructor Detail

LabelValue

public LabelValue()
Default constructor.


LabelValue

public LabelValue(java.lang.String label,
                  java.lang.String value)
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 Detail

getLabel

public java.lang.String getLabel()
get label.

Returns:
String String

setLabel

public void setLabel(java.lang.String label)
set label.

Parameters:
label - String

getValue

public java.lang.String getValue()
get value.

Returns:
value String

setValue

public void setValue(java.lang.String value)
set value.

Parameters:
value - String.

compareTo

public int compareTo(java.lang.Object o)
Compare LabelValueBeans based on the label, because that's the human viewable part of the object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - Ojbject
Returns:
int int
See Also:
Comparable

toString

public java.lang.String toString()
Return a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
sb StringBuffer