Class UUIDv7
java.lang.Object
org.tailormap.api.util.UUIDv7
A utility class to create UUID version 7, which is time-sortable.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic UUIDfromString(String value) Parse a string representation of a UUIDv7.static UUIDrandomV7()Create a random version 7 UUID.static longExtract the Unix epoch timestamp (milliseconds) from a UUIDv7.static InstanttimestampAsInstant(UUID uuidv7) Extract the Unix epoch timestamp as an Instant from a UUIDv7.
-
Method Details
-
randomV7
-
timestamp
Extract the Unix epoch timestamp (milliseconds) from a UUIDv7.- Parameters:
uuidv7- the UUIDv7 value- Returns:
- the embedded Unix epoch timestamp in milliseconds
- Throws:
IllegalArgumentException- if the given UUID is not version 7
-
timestampAsInstant
Extract the Unix epoch timestamp as an Instant from a UUIDv7.- Parameters:
uuidv7- the UUIDv7 value- Returns:
- the embedded Unix epoch timestamp in milliseconds
- Throws:
IllegalArgumentException- if the given UUID is not version 7- See Also:
-
fromString
Parse a string representation of a UUIDv7.Accepts the standard
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxformat.- Parameters:
value- the string to parse- Returns:
- the parsed UUIDv7
- Throws:
IllegalArgumentException- if the string is not a valid UUID or not version 7
-