org.jboss.messaging.util
Class UUID

java.lang.Object
  extended by org.jboss.messaging.util.UUID

public class UUID
extends java.lang.Object

UUID represents Universally Unique Identifiers (aka Global UID in Windows world). UUIDs are usually generated via UUIDGenerator (or in case of 'Null UUID', 16 zero bytes, via static method getNullUUID()), or received from external systems. By default class caches the string presentations of UUIDs so that description is only created the first time it's needed. For memory stingy applications this caching can be turned off (note though that if uuid.toString() is never called, desc is never calculated so only loss is the space allocated for the desc pointer... which can of course be commented out to save memory). Similarly, hash code is calculated when it's needed for the first time, and from thereon that value is just returned. This means that using UUIDs as keys should be reasonably efficient. UUIDs can be compared for equality, serialized, cloned and even sorted. Equality is a simple bit-wise comparison. Ordering (for sorting) is done by first ordering based on type (in the order of numeric values of types), secondarily by time stamp (only for time-based time stamps), and finally by straight numeric byte-by-byte comparison (from most to least significant bytes).


Field Summary
static byte INDEX_CLOCK_HI
           
static byte INDEX_CLOCK_LO
           
static byte INDEX_CLOCK_MID
           
static byte INDEX_CLOCK_SEQUENCE
           
static byte INDEX_TYPE
           
static byte INDEX_VARIATION
           
static java.lang.String NAMESPACE_DNS
           
static java.lang.String NAMESPACE_OID
           
static java.lang.String NAMESPACE_URL
           
static java.lang.String NAMESPACE_X500
           
static byte TYPE_DCE
           
static byte TYPE_NAME_BASED
           
static byte TYPE_NULL
           
static byte TYPE_RANDOM_BASED
           
static byte TYPE_TIME_BASED
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Checking equality of UUIDs is easy; just compare the 128-bit number.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INDEX_CLOCK_HI

public static final byte INDEX_CLOCK_HI
See Also:
Constant Field Values

INDEX_CLOCK_MID

public static final byte INDEX_CLOCK_MID
See Also:
Constant Field Values

INDEX_CLOCK_LO

public static final byte INDEX_CLOCK_LO
See Also:
Constant Field Values

INDEX_TYPE

public static final byte INDEX_TYPE
See Also:
Constant Field Values

INDEX_CLOCK_SEQUENCE

public static final byte INDEX_CLOCK_SEQUENCE
See Also:
Constant Field Values

INDEX_VARIATION

public static final byte INDEX_VARIATION
See Also:
Constant Field Values

TYPE_NULL

public static final byte TYPE_NULL
See Also:
Constant Field Values

TYPE_TIME_BASED

public static final byte TYPE_TIME_BASED
See Also:
Constant Field Values

TYPE_DCE

public static final byte TYPE_DCE
See Also:
Constant Field Values

TYPE_NAME_BASED

public static final byte TYPE_NAME_BASED
See Also:
Constant Field Values

TYPE_RANDOM_BASED

public static final byte TYPE_RANDOM_BASED
See Also:
Constant Field Values

NAMESPACE_DNS

public static final java.lang.String NAMESPACE_DNS
See Also:
Constant Field Values

NAMESPACE_URL

public static final java.lang.String NAMESPACE_URL
See Also:
Constant Field Values

NAMESPACE_OID

public static final java.lang.String NAMESPACE_OID
See Also:
Constant Field Values

NAMESPACE_X500

public static final java.lang.String NAMESPACE_X500
See Also:
Constant Field Values
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Checking equality of UUIDs is easy; just compare the 128-bit number.

Overrides:
equals in class java.lang.Object


Copyright © 2006 JBoss Inc. All Rights Reserved.