public class GUID
extends java.lang.Object
GUID
class encapsulates a GUID (Globally Unique IDentifier).
GUID instances are immutable.Constructor and Description |
---|
GUID(byte[] guid)
Constructs a GUID with the specified value.
|
GUID(java.lang.String guid)
Constructs a GUID with the specified value.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
canonize(java.lang.String guid)
Canonizes the given GUID string into the canonical format of the form:
"aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", with all values presented as
lowercase hex digits.
|
boolean |
equals(java.lang.Object o)
Returns whether this GUID is identical to the given GUID.
|
int |
hashCode()
Returns a hash code value for the object.
|
byte[] |
toByteArray()
Returns the GUID as a 16-byte array.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
public GUID(java.lang.String guid)
guid
- the GUID value as a hex string (with optional canonical
dashes)java.lang.IllegalArgumentException
- if the given string does not contain a valid GUIDpublic GUID(byte[] guid)
guid
- the GUID valuejava.lang.IllegalArgumentException
- if the given array does not contain a valid GUIDpublic static java.lang.String canonize(java.lang.String guid)
guid
- the GUID valuejava.lang.IllegalArgumentException
- if the given string does not contain a valid GUIDpublic byte[] toByteArray()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
true
if this object is the same as the obj argument;
false
otherwisepublic int hashCode()
hashCode
in class java.lang.Object
Copyright © 2021. All Rights Reserved.