com.gisgraphy.model

## Class LabelValue

- java.lang.Object
- - com.gisgraphy.model.LabelValue

- All Implemented Interfaces:
    Serializable, Comparable<LabelValue>

      public class LabelValue
      extends Object
      implements Comparable<LabelValue>, 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:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Comparator<LabelValue>` | `CASE_INSENSITIVE_ORDER` Comparator that can be used for a case insensitive sort of `LabelValue` objects.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LabelValue()` Default constructor.
    `LabelValue(String label, String value)` Construct an instance with the supplied property values.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(LabelValue 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<LabelValue> 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(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(LabelValue o)

      Compare LabelValueBeans based on the label, because that's the human viewable part of the object.
      Specified by:
        `compareTo` in interface `Comparable<LabelValue>`
      Parameters:
        `o` - LabelValue object to compare to
      Returns:
        0 if labels match for compared objects
      See Also:
        `Comparable`

    - #### toString

          public String toString()

      Return a string representation of this object.
      Overrides:
        `toString` in class `Object`
      Returns:
        object as a string

    - #### equals

          public boolean equals(Object obj)

      LabelValueBeans are equal if their values are both null or equal.
      Overrides:
        `equals` in class `Object`
      Parameters:
        `obj` - object to compare to
      Returns:
        true/false based on whether values match or not
      See Also:
        `Object.equals(java.lang.Object)`

    - #### hashCode

          public int hashCode()

      The hash code is based on the object's value.
      Overrides:
        `hashCode` in class `Object`
      Returns:
        hashCode
      See Also:
        `Object.hashCode()`

Copyright © 2015. All rights reserved.