Package com.helixframework.id.uuid
Class UuidUtil.V7
java.lang.Object
com.helixframework.id.uuid.UuidUtil.V7
- Enclosing class:
- UuidUtil
A utility class for Version 7 UUID generation and manipulation according to the
IETF UUID draft specification. Version 7 UUIDs are time-ordered UUIDs that use
Unix Epoch timestamp in milliseconds as the time source.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InstantExtracts the timestamp from a Version 7 UUID.static UUIDGenerates a new Version 7 UUID with monotonically increasing random bits within the same millisecond.static UUIDrandom()Generates a new Version 7 UUID using current timestamp and random bits.
-
Constructor Details
-
V7
public V7()
-
-
Method Details
-
random
Generates a new Version 7 UUID using current timestamp and random bits.- Returns:
- new Version 7 UUID
-
monotonic
Generates a new Version 7 UUID with monotonically increasing random bits within the same millisecond.- Returns:
- new Version 7 UUID with monotonic random bits
-
extractInstant
Extracts the timestamp from a Version 7 UUID.- Parameters:
u- UUID to extract timestamp from- Returns:
- Instant representing the timestamp, or null if not a V7 UUID
-