Uid
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.
}
Content copied to clipboard
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.