RealmUUIDKSerializer

object RealmUUIDKSerializer : KSerializer<RealmUUID>

KSerializer implementation for RealmUUID. Serialized as a BsonBinary with subtype BsonBinarySubType.UUID_STANDARD, and deserialized as an unmanaged RealmUUID.

The serializer must be registered per property:

class Example : RealmObject {
@Serializable(RealmUUIDKSerializer::class)
var myUUID: RealmUUID = RealmUUID.create()
}

or per file:

@file:UseSerializers(RealmUUIDKSerializer::class)

class Example : RealmObject {
var myUUID: RealmUUID = RealmUUID.create()
}

Adding the following code snippet to a Kotlin file would conveniently register any field using a Realm datatype to its correspondent serializer:

@file:UseSerializers(
RealmListKSerializer::class,
RealmSetKSerializer::class,
RealmAnyKSerializer::class,
RealmInstantKSerializer::class,
MutableRealmIntKSerializer::class,
RealmUUIDKSerializer::class
)

Serializers for all Realm data types can be found in io.realm.kotlin.serializers.

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): RealmUUID
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: RealmUUID)