Coverage Summary for Class: GhostKindEventSerializer (com.ghost.serialization.integration.model)
| Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| GhostKindEventSerializer |
100%
(1/1)
|
83.3%
(5/6)
|
55.6%
(10/18)
|
63%
(17/27)
|
66.2%
(139/210)
|
@file:OptIn(InternalGhostApi::class)
package com.ghost.serialization.integration.model
import com.ghost.serialization.InternalGhostApi
import com.ghost.serialization.contract.GhostSerializer
import com.ghost.serialization.parser.GhostJsonFlatReader
import com.ghost.serialization.parser.GhostJsonReader
import com.ghost.serialization.parser.peekStringField
import com.ghost.serialization.writer.GhostJsonFlatWriter
import com.ghost.serialization.writer.GhostJsonWriter
/**
* High-performance serializer for [GhostKindEvent].
* Generated by GhostSerialization. Do not modify manually.
*/
public object GhostKindEventSerializer : GhostSerializer<GhostKindEvent> {
override val typeName: String = "GhostKindEvent"
/**
* Robust deserialization for [GhostKindEvent].
*/
override fun deserialize(reader: GhostJsonReader): GhostKindEvent {
val typeName = reader.peekStringField("kind") ?: reader.throwError("Missing discriminator field for sealed class")
val result = when (typeName) {
"Created" -> GhostKindEvent_CreatedSerializer.deserialize(reader)
"Deleted" -> GhostKindEvent_DeletedSerializer.deserialize(reader)
"Updated" -> GhostKindEvent_UpdatedSerializer.deserialize(reader)
else -> reader.throwError("Unknown type discriminator: $typeName")
}
return result
}
/**
* Robust deserialization for [GhostKindEvent].
*/
override fun deserialize(reader: GhostJsonFlatReader): GhostKindEvent {
val typeName = reader.peekStringField("kind") ?: reader.throwError("Missing discriminator field for sealed class")
val result = when (typeName) {
"Created" -> GhostKindEvent_CreatedSerializer.deserialize(reader)
"Deleted" -> GhostKindEvent_DeletedSerializer.deserialize(reader)
"Updated" -> GhostKindEvent_UpdatedSerializer.deserialize(reader)
else -> reader.throwError("Unknown type discriminator: $typeName")
}
return result
}
override fun serialize(writer: GhostJsonWriter, `value`: GhostKindEvent) {
when (value) {
is GhostKindEvent.Created -> GhostKindEvent_CreatedSerializer.serialize(writer, value)
is GhostKindEvent.Deleted -> GhostKindEvent_DeletedSerializer.serialize(writer, value)
is GhostKindEvent.Updated -> GhostKindEvent_UpdatedSerializer.serialize(writer, value)
}
}
override fun serialize(writer: GhostJsonFlatWriter, `value`: GhostKindEvent) {
when (value) {
is GhostKindEvent.Created -> GhostKindEvent_CreatedSerializer.serialize(writer, value)
is GhostKindEvent.Deleted -> GhostKindEvent_DeletedSerializer.serialize(writer, value)
is GhostKindEvent.Updated -> GhostKindEvent_UpdatedSerializer.serialize(writer, value)
}
}
override fun warmUp() {
try {
val reader1 = GhostJsonReader("{}".encodeToByteArray())
deserialize(reader1)
} catch (_: Exception) {
}
try {
val reader2 = GhostJsonFlatReader("{}".encodeToByteArray())
deserialize(reader2)
} catch (_: Exception) {
}
}
}