Class UlidCreator


  • public final class UlidCreator
    extends Object
    Facade to the ULID factories. The ULID has two components: - Time component: a part of 48 bits that represent the amount of milliseconds since Unix Epoch, 1970-01-01. - Random component: a byte array of 80 bits that has a random value generated a secure random generator. The maximum ULIDs that can be generated per millisecond is 2^80.
    • Method Detail

      • getUlid

        public static Ulid getUlid()
        Returns a ULID. The random component is always reset to a new random value.
        Returns:
        a ULID
      • getUlid

        public static Ulid getUlid​(long time)
        Returns a ULID with a specific time.
        Parameters:
        time - a specific time
        Returns:
        a ULID
      • getMonotonicUlid

        public static Ulid getMonotonicUlid()
        Returns a Monotonic ULID. The random component is reset to a new value every time the millisecond changes. If more than one ULID is generated within the same millisecond, the random component is incremented by one.
        Returns:
        a ULID
      • getMonotonicUlid

        public static Ulid getMonotonicUlid​(long time)
        Returns a Monotonic ULID with a specific time.
        Parameters:
        time - a specific time
        Returns:
        a ULID
      • getDefaultFactory

        public static UlidFactory getDefaultFactory()
        Returns an instance of the Default ULID factory.
        Returns:
        a ULID factory
      • getMonotonicFactory

        public static UlidFactory getMonotonicFactory()
        Returns an instance of the Monotonic ULID factory.
        Returns:
        a ULID factory