Package com.spotfire.server.util
Class Guid
- java.lang.Object
-
- com.spotfire.server.util.Guid
-
- All Implemented Interfaces:
Serializable
public final class Guid extends Object implements Serializable
This class represents an universally unique identifier (UUID), also known as globally unique identifier (GUID), seeUUID. 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 generatedUUID, i.e., anUUIDof version type 4, seeUUID.version().- Since:
- 3.0
- Author:
- Patrick Taylor
- See Also:
UUID, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Guid()Constructs a newGuid.Guid(String guid)Constructs a newGuidusing the specified guid string representation as described in thetoString()method.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Compares this object to the supplied object.inthashCode()Returns a hash code for thisGuid.static booleanisGuid(String guid)Tells whether or not the supplied guid string corresponds to a validGuid.static GuidparseGuid(String guid)Constructs a newGuidusing the specified guid string representation as described in thetoString()method.StringtoString()Returns aStringrepresentation of thisGuid.
-
-
-
Field Detail
-
EMPTY
public static final Guid EMPTY
A read-only Guid instance whose value is all zeros.
-
-
Constructor Detail
-
Guid
public Guid()
Constructs a newGuid.- Since:
- 3.0
-
Guid
public Guid(String guid)
Constructs a newGuidusing 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 aGuidas described intoString().- Since:
- 3.0
-
-
Method Detail
-
parseGuid
public static Guid parseGuid(String guid)
Constructs a newGuidusing the specified guid string representation as described in thetoString()method.- Parameters:
guid- a string that specifies aGuid.- Returns:
- a
Guidwith the specified value. - Throws:
IllegalArgumentException- if guid does not conform to the string representation of aGuidas described intoString().- Since:
- 3.0
-
isGuid
public static boolean isGuid(String guid)
Tells whether or not the supplied guid string corresponds to a validGuid.- Parameters:
guid- a string that specifies aGuid.- Returns:
trueif guid corresponds to a validGuid,falseotherwise.- Since:
- 3.0
-
equals
public boolean equals(Object obj)
Compares this object to the supplied object. The result istrueif the argument it notnull, it is of typeGuidand it contains the same value as thisGuid.
-
hashCode
public int hashCode()
Returns a hash code for thisGuid.
-
toString
public String toString()
Returns aStringrepresentation of thisGuid. TheGuidstring 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.- Overrides:
toStringin classObject- Returns:
- a
Stringrepresentation of thisGuid. - Since:
- 3.0
- See Also:
UUID.toString()
-
-