Package org.jboss.util.id
Class GUID
- java.lang.Object
-
- org.jboss.util.id.GUID
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,ID
public class GUID extends java.lang.Object implements ID, java.lang.Comparable
A globally unique identifier (globally across a cluster of virtual machines).The identifier is composed of:
- The VMID for the virtual machine.
- A UID to provide uniqueness over a VMID.
[ address ] - [ process id ] - [ time ] - [ counter ] - [ time ] - [ counter ] |------- UID --------| |------- UID --------| |---------------------- VMID -----------------------|- Version:
- $Revision$
- See Also:
VMID,UID, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected inthashCodeThe hash code of this GUID(package private) static longserialVersionUIDThe serial version id, @since 1.6private java.lang.StringtoStringprotected UIDuidThe unique identifierprotected VMIDvmidThe virtual machine identifier
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringasString()Returns a GUID as a string.java.lang.Objectclone()Returns a copy of this GUID.intcompareTo(java.lang.Object o)booleanequals(java.lang.Object obj)Check if the given object is equal to this GUID.UIDgetUID()Get the UID portion of this GUID.VMIDgetVMID()Get the VMID portion of this GUID.inthashCode()Return the hash code of this GUID.java.lang.StringtoString()Return a string representation of this GUID.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
The serial version id, @since 1.6- See Also:
- Constant Field Values
-
vmid
protected final VMID vmid
The virtual machine identifier
-
uid
protected final UID uid
The unique identifier
-
hashCode
protected final int hashCode
The hash code of this GUID
-
toString
private transient java.lang.String toString
-
-
Constructor Detail
-
GUID
public GUID()
Construct a new GUID.
-
GUID
protected GUID(GUID guid)
Copy a GUID.- Parameters:
guid- GUID to copy.
-
-
Method Detail
-
getVMID
public final VMID getVMID()
Get the VMID portion of this GUID.- Returns:
- The VMID portion of this GUID.
-
getUID
public final UID 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.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this GUID.
-
hashCode
public int hashCode()
Return the hash code of this GUID.- Overrides:
hashCodein classjava.lang.Object- 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.
- Overrides:
equalsin classjava.lang.Object- 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.- Overrides:
clonein classjava.lang.Object- 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:
compareToin interfacejava.lang.Comparable
-
-