Class UuidUtil.V4

java.lang.Object
com.helixframework.id.uuid.UuidUtil.V4
Enclosing class:
UuidUtil

public static final class UuidUtil.V4 extends Object
A utility class for Version 4 UUID generation and manipulation. Provides methods for generating random and ordered UUIDs with version 4.
  • Constructor Details

    • V4

      public V4()
  • Method Details

    • random

      public static UUID random()
      Generates a random Version 4 UUID.
      Returns:
      new random Version 4 UUID
    • ordered

      public static UUID ordered()
      Generates a monotonically ordered Version 4 UUID. MSB encodes the current epoch millis (with version 4 set) without modification. LSB carries a 62-bit counter/random value with RFC 4122 variant, ensuring monotonicity within the same millisecond.
      Returns:
      new monotonically ordered Version 4 UUID
    • extractInstant

      public static Instant extractInstant(UUID u)
      Extracts the timestamp from a Version 4 UUID.
      Parameters:
      u - UUID to extract timestamp from
      Returns:
      Instant representing the timestamp, or null if not a V4 UUID