public final class UUID7 extends java.lang.Object implements java.lang.Comparable<UUID7>, java.io.Serializable
UUIDv7 is a time-based UUID version that is lexicographically sortable and contains a timestamp.
The structure of a UUIDv7 is as follows:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | unix_ts_ms | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | unix_ts_ms | ver | rand_a | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |var| rand_b | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | rand_b | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(UUID7 o) |
boolean |
equals(java.lang.Object o) |
static UUID7 |
fromUUID(java.util.UUID uuid)
Creates a UUID7 from a standard java.util.UUID.
|
static UUID7 |
generate()
Generates a new UUIDv7.
|
long |
getTimestamp()
Returns the timestamp embedded in this UUIDv7.
|
int |
hashCode() |
java.lang.String |
toString() |
java.util.UUID |
toUUID()
Converts this UUIDv7 to a standard java.util.UUID.
|
public static UUID7 generate()
public static UUID7 fromUUID(java.util.UUID uuid)
uuid - The UUID to convert.public long getTimestamp()
public java.util.UUID toUUID()
public int compareTo(UUID7 o)
compareTo in interface java.lang.Comparable<UUID7>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object