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 int
hashCode
The hash code of this GUID(package private) static long
serialVersionUID
The serial version id, @since 1.6private java.lang.String
toString
protected UID
uid
The unique identifierprotected VMID
vmid
The virtual machine identifier
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
getUID()
Get the UID portion of this GUID.VMID
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.
-
-
-
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:
toString
in classjava.lang.Object
- Returns:
- A string representation of this GUID.
-
hashCode
public int hashCode()
Return the hash code of this GUID.- Overrides:
hashCode
in 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:
equals
in 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:
clone
in 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:
compareTo
in interfacejava.lang.Comparable
-
-