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

org.http4k.connect.amazon.model.KotshiFormatVersionJsonAdapter.kt Maven / Gradle / Ivy

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

import com.squareup.moshi.JsonDataException
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import java.io.IOException
import kotlin.Suppress
import kotlin.jvm.Throws
import se.ansman.kotshi.InternalKotshiApi
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 KotshiFormatVersionJsonAdapter : NamedJsonAdapter("KotshiJsonAdapter(FormatVersion)") {
  private val options: JsonReader.Options = JsonReader.Options.of(
      "V0_11",
      "V0_12"
  )

  @Throws(IOException::class)
  override fun toJson(writer: JsonWriter, `value`: FormatVersion?) {
    when (`value`) {
      FormatVersion.V0_11 -> writer.value("V0_11")
      FormatVersion.V0_12 -> writer.value("V0_12")
      null -> writer.nullValue()
    }
  }

  @Throws(IOException::class)
  override fun fromJson(reader: JsonReader): FormatVersion? = if (reader.peek() == JsonReader.Token.NULL) {
    reader.nextNull()
  } else when (reader.selectString(options)) {
    0 -> FormatVersion.V0_11
    1 -> FormatVersion.V0_12
    else -> throw JsonDataException("""Expected one of [V0_11, V0_12] but was ${reader.nextString()} at path ${reader.path}""")
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy