Uid

class Uid<T> : Parcelable

Generic immutable unique ID class, meaning it's an abstraction of UUIDs. Used to uniquely identify things.

The class has a generic type T to allow creating type-safe IDs, like Uid<Message> or Uid<Person>.

For example, this does not compile:

fun compileTimeTypeSafetyExamples() {
var idInt = Uid.new<Int>()
var idLong = Uid.new<Long>()
idInt == idLong // This is OK.
idInt = idLong // This does not compile.
}

The class represents UUIDs as Strings internally, to avoid lots of UUID to String conversions. This makes the class considerably faster in use than the regular UUID class.

Parameters

T

Type tag for ID, to make IDs type-safe.

Constructors

Link copied to clipboard
fun Uid(parcel: Parcel)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun describeContents(): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun writeToParcel(parcel: Parcel, flags: Int)