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

Class Class, % Method, % Branch, % Line, % Instruction, %
SymbolItemSerializer 100% (1/1) 66.7% (6/9) 33.3% (12/36) 42.1% (48/114) 42.4% (214/505)


 @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.GhostJsonStringReader
 import com.ghost.serialization.parser.JsonReaderOptions
 import com.ghost.serialization.parser.beginArray
 import com.ghost.serialization.parser.beginObject
 import com.ghost.serialization.parser.endArray
 import com.ghost.serialization.parser.endObject
 import com.ghost.serialization.parser.nextInt
 import com.ghost.serialization.parser.nextString
 import com.ghost.serialization.parser.readList
 import com.ghost.serialization.parser.selectNameAndConsume
 import com.ghost.serialization.parser.skipValue
 import com.ghost.serialization.writer.GhostJsonFlatWriter
 import com.ghost.serialization.writer.GhostJsonStringWriter
 import com.ghost.serialization.writer.GhostJsonWriter
 import kotlin.collections.List
 import okio.ByteString
 import okio.ByteString.Companion.encodeUtf8
 
 /**
  * High-performance serializer for [SymbolItem].
  * Generated by GhostSerialization. Do not modify manually.
  */
 public object SymbolItemSerializer : GhostSerializer<SymbolItem> {
   override val typeName: String = "SymbolItem"
 
   private val OPTIONS: JsonReaderOptions = JsonReaderOptions.of(0, 31, 128, true, "text", "indices")
 
   private val H_INDICES: ByteString = "\"indices\":".encodeUtf8()
 
   private val HS_INDICES: String = "\"indices\":"
 
   private val H_TEXT: ByteString = "\"text\":".encodeUtf8()
 
   private val HS_TEXT: String = "\"text\":"
 
   private const val MASK_TEXT: Long = 1L
 
   private const val MASK_INDICES: Long = 2L
 
   private const val MASK_OPTS_INDICES_TEXT: Long = 3L
 
   private const val MASK_OPTS_TEXT: Long = 1L
 
   private const val MASK_OPTS_INDICES: Long = 2L
 
   /**
    * Robust deserialization for [SymbolItem].
    */
   override fun deserialize(reader: GhostJsonReader): SymbolItem {
     var textValue: String? = null
     var indicesValue: List<Int>? = null
     var mask0 = 0L
     reader.beginObject()
     while (true) {
       val index = reader.selectNameAndConsume(OPTIONS)
       when (index) {
         0 -> {
           textValue = reader.nextString()
           mask0 = mask0 or MASK_TEXT
         }
         1 -> {
           indicesValue = reader.readList { reader.nextInt() }
           mask0 = mask0 or MASK_INDICES
         }
         -1 -> break
         -2 -> {
           reader.skipValue()
         }
       }
     }
     reader.endObject()
     if ((mask0 and MASK_OPTS_INDICES_TEXT) == MASK_OPTS_INDICES_TEXT) {
       return SymbolItem(
         text = textValue!!,
         indices = indicesValue!!,
       )
     }
     if ((mask0 and MASK_OPTS_TEXT) == MASK_OPTS_TEXT) {
       return SymbolItem(
         text = textValue!!,
       )
     }
     if ((mask0 and MASK_OPTS_INDICES) == MASK_OPTS_INDICES) {
       return SymbolItem(
         indices = indicesValue!!,
       )
     }
     return SymbolItem(
     )
   }
 
   /**
    * Robust deserialization for [SymbolItem].
    */
   override fun deserialize(reader: GhostJsonFlatReader): SymbolItem {
     var textValue: String? = null
     var indicesValue: List<Int>? = null
     var mask0 = 0L
     reader.beginObject()
     while (true) {
       val index = reader.selectNameAndConsume(OPTIONS)
       when (index) {
         0 -> {
           textValue = reader.nextString()
           mask0 = mask0 or MASK_TEXT
         }
         1 -> {
           indicesValue = reader.readList { reader.nextInt() }
           mask0 = mask0 or MASK_INDICES
         }
         -1 -> break
         -2 -> {
           reader.skipValue()
         }
       }
     }
     reader.endObject()
     if ((mask0 and MASK_OPTS_INDICES_TEXT) == MASK_OPTS_INDICES_TEXT) {
       return SymbolItem(
         text = textValue!!,
         indices = indicesValue!!,
       )
     }
     if ((mask0 and MASK_OPTS_TEXT) == MASK_OPTS_TEXT) {
       return SymbolItem(
         text = textValue!!,
       )
     }
     if ((mask0 and MASK_OPTS_INDICES) == MASK_OPTS_INDICES) {
       return SymbolItem(
         indices = indicesValue!!,
       )
     }
     return SymbolItem(
     )
   }
 
   /**
    * Robust deserialization for [SymbolItem].
    */
   override fun deserialize(reader: GhostJsonStringReader): SymbolItem {
     var textValue: String? = null
     var indicesValue: List<Int>? = null
     var mask0 = 0L
     reader.beginObject()
     while (true) {
       val index = reader.selectNameAndConsume(OPTIONS)
       when (index) {
         0 -> {
           textValue = reader.nextString()
           mask0 = mask0 or MASK_TEXT
         }
         1 -> {
           indicesValue = reader.readList { reader.nextInt() }
           mask0 = mask0 or MASK_INDICES
         }
         -1 -> break
         -2 -> {
           reader.skipValue()
         }
       }
     }
     reader.endObject()
     if ((mask0 and MASK_OPTS_INDICES_TEXT) == MASK_OPTS_INDICES_TEXT) {
       return SymbolItem(
         text = textValue!!,
         indices = indicesValue!!,
       )
     }
     if ((mask0 and MASK_OPTS_TEXT) == MASK_OPTS_TEXT) {
       return SymbolItem(
         text = textValue!!,
       )
     }
     if ((mask0 and MASK_OPTS_INDICES) == MASK_OPTS_INDICES) {
       return SymbolItem(
         indices = indicesValue!!,
       )
     }
     return SymbolItem(
     )
   }
 
   override fun serialize(writer: GhostJsonWriter, `value`: SymbolItem) {
     writer.beginObject()
     writer.writeField(H_TEXT, value.text)
     writer.writeNameRaw(H_INDICES)
     writer.beginArray()
     val size0 = value.indices.size
     for (i0 in 0 until size0) {
       val item0 = value.indices[i0]
       writer.value(item0)
     }
     writer.endArray()
     writer.endObject()
   }
 
   override fun serialize(writer: GhostJsonFlatWriter, `value`: SymbolItem) {
     writer.beginObject()
     writer.writeField(H_TEXT, value.text)
     writer.writeNameRaw(H_INDICES)
     writer.beginArray()
     val size0 = value.indices.size
     for (i0 in 0 until size0) {
       val item0 = value.indices[i0]
       writer.value(item0)
     }
     writer.endArray()
     writer.endObject()
   }
 
   override fun serialize(writer: GhostJsonStringWriter, `value`: SymbolItem) {
     writer.beginObject()
     writer.writeField(HS_TEXT, value.text)
     writer.writeNameRaw(HS_INDICES)
     writer.beginArray()
     val size0 = value.indices.size
     for (i0 in 0 until size0) {
       val item0 = value.indices[i0]
       writer.value(item0)
     }
     writer.endArray()
     writer.endObject()
   }
 
   override fun warmUp() {
     try {
       val reader1 = GhostJsonReader("{}".encodeToByteArray())
       deserialize(reader1)
     } catch (_: Exception) {
     }
     try {
       val reader2 = GhostJsonFlatReader("{}".encodeToByteArray())
       deserialize(reader2)
     } catch (_: Exception) {
     }
     try {
       val reader3 = GhostJsonStringReader("{}")
       deserialize(reader3)
     } catch (_: Exception) {
     }
   }
 }