Class NamePair

java.lang.Object
org.compiere.util.NamePair
All Implemented Interfaces:
Serializable, Comparable<Object>, Comparator<Object>
Direct Known Subclasses:
KeyNamePair, ValueNamePair, WGadgets.ListElement, WRC2FieldOrderPanel.ListElement, WRC3SortCriteriaPanel.ListElement

public abstract class NamePair extends Object implements Comparator<Object>, Serializable, Comparable<Object>
Abstract Name ID Pair class
Version:
$Id: NamePair.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Constructor Details

    • NamePair

      protected NamePair(String name)
      Protected Constructor
      Parameters:
      name - (Display) Name of the Pair
  • Method Details

    • getName

      public String getName()
      Returns display value
      Returns:
      name
    • getID

      public abstract String getID()
      Returns Key or Value as String
      Returns:
      String ID or null
    • compare

      public int compare(Object o1, Object o2)
      Compare o1 and o2 (based on toString value)
      Specified by:
      compare in interface Comparator<Object>
      Parameters:
      o1 - Object 1
      o2 - Object 2
      Returns:
      compareTo value
    • compare

      public int compare(NamePair o1, NamePair o2)
      Compare o1 and o2 (based on toString value) using Collator
      Parameters:
      o1 - Object 1
      o2 - Object 2
      Returns:
      compareTo value
    • compareTo

      public int compareTo(Object o)
      Comparable Interface (based on toString value)
      Specified by:
      compareTo in interface Comparable<Object>
      Parameters:
      o - the Object to be compared.
      Returns:
      a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
    • compareTo

      public int compareTo(NamePair o)
      Comparable Interface (based on toString value) using Collator
      Parameters:
      o - the Object to be compared.
      Returns:
      a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
    • toString

      public String toString()
      To String - returns name
      Overrides:
      toString in class Object
      Returns:
      Name
    • toStringX

      public String toStringX()
      To String - detail
      Returns:
      String in format ID=Name