public final class UUIDPersistentHandle extends java.lang.Object implements HGPersistentHandle
Modifier and Type | Field and Description |
---|---|
static int |
SIZE
The number of bytes in the
byte [] representation
of a UUIDPersistentHandle . |
static UUIDPersistentHandle |
UUID_NULL_HANDLE |
Constructor and Description |
---|
UUIDPersistentHandle()
Default constructor create a new UUID.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(HGHandle other) |
int |
compareTo(HGPersistentHandle other) |
boolean |
equals(java.lang.Object other) |
HGPersistentHandle |
getPersistent() |
UUID |
getUuid() |
int |
hashCode() |
static UUIDPersistentHandle |
makeHandle()
Construct a brand new UUID-based handle.
|
static UUIDPersistentHandle |
makeHandle(byte[] value)
Construct from an existing UUID.
|
static UUIDPersistentHandle |
makeHandle(byte[] value,
int offset)
Construct from an existing UUID.
|
static UUIDPersistentHandle |
makeHandle(java.lang.String value)
Construct from an existing UUID.
|
static UUIDPersistentHandle |
nullHandle()
Return the representation of a
nil handle, that is a handle that does
not refer to anything. |
void |
setUuid(UUID uuid) |
byte[] |
toByteArray()
Return a
byte [] representation of this UUIDPersistentHandle . |
java.lang.String |
toString() |
java.lang.String |
toStringValue() |
public static final int SIZE
byte []
representation
of a UUIDPersistentHandle
.public static final UUIDPersistentHandle UUID_NULL_HANDLE
public UUIDPersistentHandle()
Default constructor create a new UUID.
public static UUIDPersistentHandle nullHandle()
Return the representation of a nil
handle, that is a handle that does
not refer to anything.
public static UUIDPersistentHandle makeHandle()
Construct a brand new UUID-based handle. A UUID will be generated based on the algorithm configured at application started.
public static UUIDPersistentHandle makeHandle(byte[] value)
Construct from an existing UUID.
value
- An array of UUIDPersistentHandle.SIZE
bytes representing the UUID. If this parameter
is null
or of size != UUIDPersistentHandle.SIZE
, an IllegalArgumentException
is thrown.public static UUIDPersistentHandle makeHandle(byte[] value, int offset)
Construct from an existing UUID.
value
- An array of offset + UUIDPersistentHandle.SIZE
bytes representing the UUID. If this parameter
is null
or of size < offset + UUIDPersistentHandle.SIZE
, an IllegalArgumentException
is thrown.offset
- The starting position in value
of the data holding the
UUIDPersistentHandle
representation.public static UUIDPersistentHandle makeHandle(java.lang.String value)
Construct from an existing UUID.
value
- A UTF-8 encoded string representation of the UUIDpublic byte[] toByteArray()
Return a byte []
representation of this UUIDPersistentHandle
.
toByteArray
in interface HGPersistentHandle
public UUID getUuid()
public void setUuid(UUID uuid)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringValue()
public int compareTo(HGHandle other)
public int compareTo(HGPersistentHandle other)
compareTo
in interface java.lang.Comparable<HGPersistentHandle>
public HGPersistentHandle getPersistent()
getPersistent
in interface HGHandle