Package com.spotfire.server.util
Class Guid
java.lang.Object
com.spotfire.server.util.Guid
- All Implemented Interfaces:
Serializable
This class represents an universally unique identifier (UUID), also known as globally unique identifier (GUID), see
This class uses randomly generated
UUID
. A UUID represents a 128-bit value and is either guaranteed to be different from all other
UUIDs/GUIDs generated until 3400 A.D., or extremely likely to be different. This class uses randomly generated
UUID
, i.e., an UUID
of version type 4, see
UUID.version()
.- Since:
- 3.0
- Author:
- Patrick Taylor
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGuid()
Constructs a newGuid
.Constructs a newGuid
using the specified guid string representation as described in thetoString()
method. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this object to the supplied object.int
hashCode()
Returns a hash code for thisGuid
.static boolean
Tells whether or not the supplied guid string corresponds to a validGuid
.static Guid
Constructs a newGuid
using the specified guid string representation as described in thetoString()
method.toString()
Returns aString
representation of thisGuid
.
-
Field Details
-
EMPTY
A read-only Guid instance whose value is all zeros.
-
-
Constructor Details
-
Guid
public Guid()Constructs a newGuid
.- Since:
- 3.0
-
Guid
Constructs a newGuid
using the specified guid string representation as described in thetoString()
method.- Parameters:
guid
- a string that specifies aGuid
.- Throws:
IllegalArgumentException
- if guid does not conform to the string representation of aGuid
as described intoString()
.- Since:
- 3.0
-
-
Method Details
-
parseGuid
Constructs a newGuid
using the specified guid string representation as described in thetoString()
method.- Parameters:
guid
- a string that specifies aGuid
.- Returns:
- a
Guid
with the specified value. - Throws:
IllegalArgumentException
- if guid does not conform to the string representation of aGuid
as described intoString()
.- Since:
- 3.0
-
isGuid
Tells whether or not the supplied guid string corresponds to a validGuid
.- Parameters:
guid
- a string that specifies aGuid
.- Returns:
true
if guid corresponds to a validGuid
,false
otherwise.- Since:
- 3.0
-
equals
Compares this object to the supplied object. The result istrue
if the argument it notnull
, it is of typeGuid
and it contains the same value as thisGuid
. -
hashCode
public int hashCode()Returns a hash code for thisGuid
. -
toString
Returns aString
representation of thisGuid
. TheGuid
string representation is on the following format, where x represents a hexadecimal ([0-9][a-f][A-F]) digit, "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
The returned string is always in lower case.
-