Class ShortPrefixCombFactory


  • public final class ShortPrefixCombFactory
    extends AbstCombFactory
    Concrete factory for creating Short Prefix COMB GUIDs.

    A Short Prefix COMB GUID is a UUID that combines a creation time with random bits.

    The creation minute is a 2 bytes PREFIX at the MOST significant bits.

    The prefix wraps around every ~45 days (2^16/60/24 = ~45).

    The created UUID is a UUIDv4 for compatibility with RFC 9562.

    See Also:
    Sequential UUID Generators
    • Field Detail

      • interval

        protected final int interval
        Interval in milliseconds.
      • DEFAULT_INTERVAL

        protected static final int DEFAULT_INTERVAL
        Default interval of 60 seconds in milliseconds.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ShortPrefixCombFactory

        public ShortPrefixCombFactory()
        Default constructor.
      • ShortPrefixCombFactory

        public ShortPrefixCombFactory​(Clock clock)
        Constructor with a clock.
        Parameters:
        clock - a clock
      • ShortPrefixCombFactory

        public ShortPrefixCombFactory​(Random random)
        Constructor with a random.
        Parameters:
        random - a random generator
      • ShortPrefixCombFactory

        public ShortPrefixCombFactory​(Random random,
                                      Clock clock)
        Constructor with a random and a clock.
        Parameters:
        random - a random
        clock - a clock
      • ShortPrefixCombFactory

        public ShortPrefixCombFactory​(LongSupplier randomFunction)
        Constructor with a function which return random numbers.
        Parameters:
        randomFunction - a function
      • ShortPrefixCombFactory

        public ShortPrefixCombFactory​(LongSupplier randomFunction,
                                      Clock clock)
        Constructor with a function which a function which return random numbers and a clock.
        Parameters:
        randomFunction - a function
        clock - a clock