Class UlidCreator


  • public final class UlidCreator
    extends Object
    A factory for Universally Unique Lexicographically Sortable Identifiers. See the ULID spec: https://github.com/ulid/spec
    • Method Detail

      • fromString

        public static UUID fromString​(String ulid)
        Returns a ULID as GUID from a string. The input string must be encoded to Crockford's base32, following the ULID specification. An exception is thrown if the ULID string is invalid.
        Parameters:
        ulid - a ULID string
        Returns:
        a UUID
        Throws:
        InvalidUlidException - if invalid
      • toString

        public static String toString​(UUID ulid)
        Convert a UUID to ULID string The returning string is encoded to Crockford's base32.
        Parameters:
        uuid - a UUID
        Returns:
        a ULID string
      • getUlid

        public static UUID getUlid()
        Returns a ULID as GUID. The random component is generated by a secure random number generator: SecureRandom.
        Returns:
        a UUID
      • getUlidString

        public static String getUlidString()
        Returns a ULID string. The returning string is encoded to Crockford's base32. The random component is generated by a secure random number generator: SecureRandom.
        Returns:
        a ULID string