Package 

Class TypedID

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final String type
      public final Ulid ulid
    • Method Summary

      Modifier and Type Method Description
      boolean equals(Object o)
      int hashCode()
      Array<byte> toBytes() Encodes the binary representation of this typed identifier to a byte array
      static TypedID fromBytes(Array<byte> input) Decodes a binary representation of a typed identifier.
      String toString() Encodes the text representation of this typed identifier to a string
      static TypedID newWithRandomULID(String type) Generates a new typed identifier of the type {@code type} and with a new random ULID using
      static TypedID newWithULID(String type, Ulid ulid) Generates a new typed identifier of the type {@code type} and with the ULID {@code ulid}.Does some sanity checks on the type and ULID.
      static TypedID newWithUUID(String type, UUID uuid) Generates a new typed identifier of the type {@code type} and with the UUID {@code uuid}.Does some sanity checks on the type and ULID.
      static TypedID parse(String input) Parse parses the input string as a typed identifier.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toBytes

         Array<byte> toBytes()

        Encodes the binary representation of this typed identifier to a byte array

      • fromBytes

         static TypedID fromBytes(Array<byte> input)

        Decodes a binary representation of a typed identifier.

        Parameters:
        input - The bytes of the typed identifier
      • toString

        @NonNull() String toString()

        Encodes the text representation of this typed identifier to a string

      • newWithRandomULID

         static TypedID newWithRandomULID(String type)

        Generates a new typed identifier of the type {@code type} and with a new random ULID using

        Parameters:
        type - The type of the typed identifier
      • newWithULID

         static TypedID newWithULID(String type, Ulid ulid)

        Generates a new typed identifier of the type {@code type} and with the ULID {@code ulid}.Does some sanity checks on the type and ULID.

        Parameters:
        type - The type of the typed identifier
        ulid - The ULID for the typed identifier
      • newWithUUID

         static TypedID newWithUUID(String type, UUID uuid)

        Generates a new typed identifier of the type {@code type} and with the UUID {@code uuid}.Does some sanity checks on the type and ULID.

        Parameters:
        type - The type of the typed identifier
        uuid - The base UUID of the ULID for the typed identifier (
      • parse

         static TypedID parse(String input)

        Parse parses the input string as a typed identifier.

        Parameters:
        input - The input string