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

org.http4k.connect.amazon.firehose.action.KotshiCreatedDeliveryStreamJsonAdapter.kt Maven / Gradle / Ivy

The newest version!
// Code generated by Kotshi. Do not edit.
package org.http4k.connect.amazon.firehose.action

import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonDataException
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import java.io.IOException
import java.lang.StringBuilder
import kotlin.Suppress
import kotlin.apply
import kotlin.collections.setOf
import kotlin.jvm.Throws
import org.http4k.connect.amazon.core.model.ARN
import se.ansman.kotshi.InternalKotshiApi
import se.ansman.kotshi.KotshiUtils.appendNullableError
import se.ansman.kotshi.NamedJsonAdapter

@InternalKotshiApi
@Suppress(
  "DEPRECATION",
  "unused",
  "ClassName",
  "REDUNDANT_PROJECTION",
  "RedundantExplicitType",
  "LocalVariableName",
  "RedundantVisibilityModifier",
  "PLATFORM_CLASS_MAPPED_TO_KOTLIN",
  "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION",
  "EXPERIMENTAL_API_USAGE",
  "OPT_IN_USAGE",
)
internal class KotshiCreatedDeliveryStreamJsonAdapter(
  moshi: Moshi,
) : NamedJsonAdapter("KotshiJsonAdapter(CreatedDeliveryStream)") {
  private val deliveryStreamARNAdapter: JsonAdapter = moshi.adapter(
      ARN::class.javaObjectType,
      setOf(),
      "DeliveryStreamARN"
  )

  private val options: JsonReader.Options = JsonReader.Options.of("DeliveryStreamARN")

  @Throws(IOException::class)
  override fun toJson(writer: JsonWriter, `value`: CreatedDeliveryStream?) {
    if (`value` == null) {
      writer.nullValue()
      return
    }
    writer
      .beginObject()
      .name("DeliveryStreamARN").apply {
        deliveryStreamARNAdapter.toJson(this, `value`.DeliveryStreamARN)
      }
      .endObject()
  }

  @Throws(IOException::class)
  override fun fromJson(reader: JsonReader): CreatedDeliveryStream? {
    if (reader.peek() == JsonReader.Token.NULL) return reader.nextNull()

    var deliveryStreamARN: ARN? = null

    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          deliveryStreamARN = deliveryStreamARNAdapter.fromJson(reader)
        }
        -1 -> {
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()

    var errorBuilder: StringBuilder? = null
    if (deliveryStreamARN == null) {
      errorBuilder = errorBuilder.appendNullableError("DeliveryStreamARN")
    }
    if (errorBuilder != null) {
      errorBuilder.append(" (at path ").append(reader.path).append(')')
      throw JsonDataException(errorBuilder.toString())
    }

    return CreatedDeliveryStream(
        DeliveryStreamARN = deliveryStreamARN!!
    )
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy