Coverage Summary for Class: ResilientEnumModelSerializer (com.ghost.serialization.integration.model)

Class Class, % Method, % Branch, % Line, % Instruction, %
ResilientEnumModelSerializer 100% (1/1) 71.4% (5/7) 36.1% (13/36) 43.6% (34/78) 50.7% (182/359)


 @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.JsonReaderOptions
 import com.ghost.serialization.parser.beginObject
 import com.ghost.serialization.parser.consumeNull
 import com.ghost.serialization.parser.decodeResilient
 import com.ghost.serialization.parser.endObject
 import com.ghost.serialization.parser.isNextNullValue
 import com.ghost.serialization.parser.selectNameAndConsume
 import com.ghost.serialization.parser.skipValue
 import com.ghost.serialization.writer.GhostJsonFlatWriter
 import com.ghost.serialization.writer.GhostJsonWriter
 import okio.ByteString
 import okio.ByteString.Companion.encodeUtf8
 
 /**
  * High-performance serializer for [ResilientEnumModel].
  * Generated by GhostSerialization. Do not modify manually.
  */
 public object ResilientEnumModelSerializer : GhostSerializer<ResilientEnumModel> {
   override val typeName: String = "ResilientEnumModel"
 
   private val OPTIONS: JsonReaderOptions =
       JsonReaderOptions.of(0, 31, 128, false, "status", "nullableStatus")
 
   private val H_NULLABLESTATUS: ByteString = "\"nullableStatus\":".encodeUtf8()
 
   private val H_STATUS: ByteString = "\"status\":".encodeUtf8()
 
   private const val MASK_STATUS: Long = 1L
 
   private const val MASK_NULLABLESTATUS: Long = 2L
 
   private const val MASK_OPTS_NULLABLESTATUS_STATUS: Long = 3L
 
   private const val MASK_OPTS_STATUS: Long = 1L
 
   private const val MASK_OPTS_NULLABLESTATUS: Long = 2L
 
   /**
    * Robust deserialization for [ResilientEnumModel].
    */
   override fun deserialize(reader: GhostJsonReader): ResilientEnumModel {
     var statusValue: GhostStandardsEnum? = null
     var nullableStatusValue: GhostStandardsEnum? = null
     var mask0 = 0L
     reader.beginObject()
     while (true) {
       val index = reader.selectNameAndConsume(OPTIONS)
       when (index) {
         0 -> {
           reader.decodeResilient { GhostStandardsEnumSerializer.deserialize(reader) }?.let {
             statusValue = it
             mask0 = mask0 or MASK_STATUS
           }
         }
         1 -> {
           reader.decodeResilient { if (reader.isNextNullValue()) { reader.consumeNull(); null } else GhostStandardsEnumSerializer.deserialize(reader) }?.let {
             nullableStatusValue = it
             mask0 = mask0 or MASK_NULLABLESTATUS
           }
         }
         -1 -> break
         -2 -> {
           reader.skipValue()
         }
       }
     }
     reader.endObject()
     if ((mask0 and MASK_OPTS_NULLABLESTATUS_STATUS) == MASK_OPTS_NULLABLESTATUS_STATUS) {
       return ResilientEnumModel(
         status = statusValue!!,
         nullableStatus = nullableStatusValue,
       )
     }
     if ((mask0 and MASK_OPTS_STATUS) == MASK_OPTS_STATUS) {
       return ResilientEnumModel(
         status = statusValue!!,
       )
     }
     if ((mask0 and MASK_OPTS_NULLABLESTATUS) == MASK_OPTS_NULLABLESTATUS) {
       return ResilientEnumModel(
         nullableStatus = nullableStatusValue,
       )
     }
     return ResilientEnumModel(
     )
   }
 
   /**
    * Robust deserialization for [ResilientEnumModel].
    */
   override fun deserialize(reader: GhostJsonFlatReader): ResilientEnumModel {
     var statusValue: GhostStandardsEnum? = null
     var nullableStatusValue: GhostStandardsEnum? = null
     var mask0 = 0L
     reader.beginObject()
     while (true) {
       val index = reader.selectNameAndConsume(OPTIONS)
       when (index) {
         0 -> {
           reader.decodeResilient { GhostStandardsEnumSerializer.deserialize(reader) }?.let {
             statusValue = it
             mask0 = mask0 or MASK_STATUS
           }
         }
         1 -> {
           reader.decodeResilient { if (reader.isNextNullValue()) { reader.consumeNull(); null } else GhostStandardsEnumSerializer.deserialize(reader) }?.let {
             nullableStatusValue = it
             mask0 = mask0 or MASK_NULLABLESTATUS
           }
         }
         -1 -> break
         -2 -> {
           reader.skipValue()
         }
       }
     }
     reader.endObject()
     if ((mask0 and MASK_OPTS_NULLABLESTATUS_STATUS) == MASK_OPTS_NULLABLESTATUS_STATUS) {
       return ResilientEnumModel(
         status = statusValue!!,
         nullableStatus = nullableStatusValue,
       )
     }
     if ((mask0 and MASK_OPTS_STATUS) == MASK_OPTS_STATUS) {
       return ResilientEnumModel(
         status = statusValue!!,
       )
     }
     if ((mask0 and MASK_OPTS_NULLABLESTATUS) == MASK_OPTS_NULLABLESTATUS) {
       return ResilientEnumModel(
         nullableStatus = nullableStatusValue,
       )
     }
     return ResilientEnumModel(
     )
   }
 
   override fun serialize(writer: GhostJsonWriter, `value`: ResilientEnumModel) {
     writer.beginObject()
     writer.writeNameRaw(H_STATUS)
     GhostStandardsEnumSerializer.serialize(writer, value.status)
     if (value.nullableStatus != null) {
       writer.writeNameRaw(H_NULLABLESTATUS)
       GhostStandardsEnumSerializer.serialize(writer, value.nullableStatus)
     }
     writer.endObject()
   }
 
   override fun serialize(writer: GhostJsonFlatWriter, `value`: ResilientEnumModel) {
     writer.beginObject()
     writer.writeNameRaw(H_STATUS)
     GhostStandardsEnumSerializer.serialize(writer, value.status)
     if (value.nullableStatus != null) {
       writer.writeNameRaw(H_NULLABLESTATUS)
       GhostStandardsEnumSerializer.serialize(writer, value.nullableStatus)
     }
     writer.endObject()
   }
 
   override fun warmUp() {
     try {
       val reader1 = GhostJsonReader("{}".encodeToByteArray())
       deserialize(reader1)
     } catch (_: Exception) {
     }
     try {
       val reader2 = GhostJsonFlatReader("{}".encodeToByteArray())
       deserialize(reader2)
     } catch (_: Exception) {
     }
   }
 }