Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.util
Class LabelValueBean

    java.lang.Object
      org.apache.struts.util.LabelValueBean

All Implemented Interfaces:
  Serializable, Comparable

    public class LabelValueBean

extends Object
implements Comparable, 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.

Version:
  $Rev: 471754 $ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005) $
See Also:
  Serialized Form

Field Summary
`static Comparator` | `CASE_INSENSITIVE_ORDER` Comparator that can be used for a case insensitive sort of `LabelValueBean` objects.

Constructor Summary
`LabelValueBean()` Default constructor.
`LabelValueBean(String label, String value)` Construct an instance with the supplied property values.

Method Summary
`int` | `compareTo(Object o)` Compare LabelValueBeans based on the label, because that's the human viewable part of the object.
`boolean` | `equals(Object obj)` LabelValueBeans are equal if their values are both null or equal.
`String` | `getLabel()`
`String` | `getValue()`
`int` | `hashCode()` The hash code is based on the object's value.
`void` | `setLabel(String label)`
`void` | `setValue(String value)`
`String` | `toString()` Return a string representation of this object.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### CASE_INSENSITIVE_ORDER

    public static final Comparator CASE_INSENSITIVE_ORDER

  Comparator that can be used for a case insensitive sort of `LabelValueBean` objects.

Constructor Detail

### LabelValueBean

    public LabelValueBean()

  Default constructor.

### LabelValueBean

    public LabelValueBean(String label,
                          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 String getLabel()

### setLabel

    public void setLabel(String label)

### getValue

    public String getValue()

### setValue

    public void setValue(String value)

### compareTo

    public int compareTo(Object o)

  Compare LabelValueBeans based on the label, because that's the human viewable part of the object.

  Specified by:
    `compareTo` in interface `Comparable`
  See Also:
    `Comparable`

### toString

    public String toString()

  Return a string representation of this object.

  Overrides:
    `toString` in class `Object`

### equals

    public boolean equals(Object obj)

  LabelValueBeans are equal if their values are both null or equal.

  Overrides:
    `equals` in class `Object`
  See Also:
    `Object.equals(Object)`

### hashCode

    public int hashCode()

  The hash code is based on the object's value.

  Overrides:
    `hashCode` in class `Object`
  See Also:
    `Object.hashCode()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.