All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.connectrpc.protocols.ErrorDetailPayloadJSONJsonAdapter.kt Maven / Gradle / Ivy

There is a newer version: 0.7.2
Show newest version
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
    "RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
    "PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")

package com.connectrpc.protocols

import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import java.lang.NullPointerException
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.emptySet
import kotlin.text.buildString

internal class ErrorDetailPayloadJSONJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("type", "value")

  private val nullableStringAdapter: JsonAdapter = moshi.adapter(String::class.java,
      emptySet(), "type")

  public override fun toString(): String = buildString(44) {
      append("GeneratedJsonAdapter(").append("ErrorDetailPayloadJSON").append(')') }

  public override fun fromJson(reader: JsonReader): ErrorDetailPayloadJSON {
    var type: String? = null
    var value__: String? = null
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> type = nullableStringAdapter.fromJson(reader)
        1 -> value__ = nullableStringAdapter.fromJson(reader)
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    return ErrorDetailPayloadJSON(
        type = type,
        `value` = value__
    )
  }

  public override fun toJson(writer: JsonWriter, value_: ErrorDetailPayloadJSON?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("type")
    nullableStringAdapter.toJson(writer, value_.type)
    writer.name("value")
    nullableStringAdapter.toJson(writer, value_.`value`)
    writer.endObject()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy