Compiere 3.1

org.compiere.util
Class KeyNamePair

java.lang.Object
  extended by org.compiere.util.NamePair
      extended by org.compiere.util.KeyNamePair
All Implemented Interfaces:
Serializable, Comparable<NamePair>, Comparator<NamePair>

public final class KeyNamePair
extends NamePair

(Numeric) Key Name Pair

Version:
$Id: KeyNamePair.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
Author:
Jorg Janke
See Also:
Serialized Form

Constructor Summary
KeyNamePair()
          Use for GWT serialization
KeyNamePair(int key, String name)
          Constructor KeyValue Pair -
 
Method Summary
 int compare(KeyNamePair p1, KeyNamePair p2)
          Comparator Interface (based on Name/ID value)
 int compareTo(KeyNamePair o)
          Comparable Interface (based on Name/ID value)
 boolean equals(Object obj)
          Equals
 String getID()
          Get ID (key as String)
 int getKey()
          Get Key
 int hashCode()
          Return Hashcode of key
 
Methods inherited from class org.compiere.util.NamePair
compare, compareTo, getName, indexOfKey, indexOfValue, isSortByName, setName, setSortByName, toString, toStringX
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyNamePair

public KeyNamePair()
Use for GWT serialization


KeyNamePair

public KeyNamePair(int key,
                   String name)
Constructor KeyValue Pair -

Parameters:
key - Key (-1 is considered as null)
name - string representation
Method Detail

getKey

public int getKey()
Get Key

Returns:
key

getID

public String getID()
Get ID (key as String)

Specified by:
getID in class NamePair
Returns:
String value of key or null if -1

equals

public boolean equals(Object obj)
Equals

Specified by:
equals in interface Comparator<NamePair>
Overrides:
equals in class Object
Parameters:
obj - object
Returns:
true if equal

compare

public int compare(KeyNamePair p1,
                   KeyNamePair p2)
Comparator Interface (based on Name/ID value)

Parameters:
p1 - Value 1
p2 - Value 2
Returns:
compareTo value

compareTo

public int compareTo(KeyNamePair o)
Comparable Interface (based on Name/ID value)

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.

hashCode

public int hashCode()
Return Hashcode of key

Overrides:
hashCode in class Object
Returns:
hascode

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.