Class ULID


  • public class ULID
    extends java.lang.Object
    • Constructor Detail

      • ULID

        public ULID()
      • ULID

        public ULID​(java.util.Random random)
    • Method Detail

      • appendULID

        public void appendULID​(java.lang.StringBuilder stringBuilder)
      • nextULID

        public java.lang.String nextULID()
      • nextULID

        public java.lang.String nextULID​(long timestamp)
      • nextValue

        public ULID.Value nextValue​(long timestamp)
      • nextMonotonicValue

        public ULID.Value nextMonotonicValue​(ULID.Value previousUlid)
        Returns the next monotonic value. If an overflow happened while incrementing the random part of the given previous ULID value then the returned value will have a zero random part.
        Parameters:
        previousUlid - the previous ULID value.
        Returns:
        the next monotonic value.
      • nextMonotonicValue

        public ULID.Value nextMonotonicValue​(ULID.Value previousUlid,
                                             long timestamp)
        Returns the next monotonic value. If an overflow happened while incrementing the random part of the given previous ULID value then the returned value will have a zero random part.
        Parameters:
        previousUlid - the previous ULID value.
        timestamp - the timestamp of the next ULID value.
        Returns:
        the next monotonic value.
      • nextStrictlyMonotonicValue

        public java.util.Optional<ULID.Value> nextStrictlyMonotonicValue​(ULID.Value previousUlid)
        Returns the next monotonic value or empty if an overflow happened while incrementing the random part of the given previous ULID value.
        Parameters:
        previousUlid - the previous ULID value.
        Returns:
        the next monotonic value or empty if an overflow happened.
      • nextStrictlyMonotonicValue

        public java.util.Optional<ULID.Value> nextStrictlyMonotonicValue​(ULID.Value previousUlid,
                                                                         long timestamp)
        Returns the next monotonic value or empty if an overflow happened while incrementing the random part of the given previous ULID value.
        Parameters:
        previousUlid - the previous ULID value.
        timestamp - the timestamp of the next ULID value.
        Returns:
        the next monotonic value or empty if an overflow happened.
      • parseULID

        public static ULID.Value parseULID​(java.lang.String ulidString)
      • fromBytes

        public static ULID.Value fromBytes​(byte[] data)