org.jboss.util.id
Class GUID

java.lang.Object
  extended byorg.jboss.util.id.GUID
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, ID (src) , java.io.Serializable

public class GUID
extends java.lang.Object
implements ID (src) , java.lang.Comparable

A globally unique identifier (globally across a cluster of virtual machines).

The identifier is composed of:

  1. The VMID for the virtual machine.
  2. A UID to provide uniqueness over a VMID.
    [ address ] - [ process id ] - [ time ] - [ counter ] - [ time ] - [ counter ]
                                   |------- UID --------|   |------- UID --------|
    |---------------------- VMID -----------------------|
 

See Also:
VMID (src) , UID (src) , Serialized Form

Field Summary
protected  int hashCode
          The hash code of this GUID
protected  UID (src) uid
          The unique identifier
protected  VMID (src) vmid
          The virtual machine identifier
 
Constructor Summary
  GUID()
          Construct a new GUID.
protected GUID(GUID (src)  guid)
          Copy a GUID.
 
Method Summary
static java.lang.String asString()
          Returns a GUID as a string.
 java.lang.Object clone()
          Returns a copy of this GUID.
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
          Check if the given object is equal to this GUID.
 UID (src) getUID()
          Get the UID portion of this GUID.
 VMID (src) getVMID()
          Get the VMID portion of this GUID.
 int hashCode()
          Return the hash code of this GUID.
 java.lang.String toString()
          Return a string representation of this GUID.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

vmid

protected final VMID (src)  vmid
The virtual machine identifier


uid

protected final UID (src)  uid
The unique identifier


hashCode

protected final int hashCode
The hash code of this GUID

Constructor Detail

GUID

public GUID()
Construct a new GUID.


GUID

protected GUID(GUID (src)  guid)
Copy a GUID.

Parameters:
guid - GUID to copy.
Method Detail

getVMID

public final VMID (src)  getVMID()
Get the VMID portion of this GUID.

Returns:
The VMID portion of this GUID.

getUID

public final UID (src)  getUID()
Get the UID portion of this GUID.

Returns:
The UID portion of this GUID.

toString

public java.lang.String toString()
Return a string representation of this GUID.

Returns:
A string representation of this GUID.

hashCode

public int hashCode()
Return the hash code of this GUID.

Returns:
The hash code of this GUID.

equals

public boolean equals(java.lang.Object obj)
Check if the given object is equal to this GUID.

A GUID is equal to another GUID if the VMID and UID portions are equal.

Parameters:
obj - Object to test equality with.
Returns:
True if object is equal to this GUID.

clone

public java.lang.Object clone()
Returns a copy of this GUID.

Returns:
A copy of this GUID.

asString

public static java.lang.String asString()
Returns a GUID as a string.

Returns:
GUID as a string.

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable