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

tech.carpentum.sdk.payment.internal.generated.model.TopUpRequestedDetailJsonJsonAdapter.kt Maven / Gradle / Ivy

There is a newer version: 2.1021.0
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 tech.carpentum.sdk.payment.`internal`.generated.model

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.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.emptySet
import kotlin.text.buildString
import tech.carpentum.sdk.payment.model.Money

public class TopUpRequestedDetailJsonJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("money", "exchangedFrom")

  private val nullableMoneyAdapter: JsonAdapter = moshi.adapter(Money::class.java,
      emptySet(), "money")

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

  public override fun fromJson(reader: JsonReader): TopUpRequestedDetailJson {
    var money: Money? = null
    var moneySet: Boolean = false
    var exchangedFrom: Money? = null
    var exchangedFromSet: Boolean = false
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          money = nullableMoneyAdapter.fromJson(reader)
          moneySet = true
        }
        1 -> {
          exchangedFrom = nullableMoneyAdapter.fromJson(reader)
          exchangedFromSet = true
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    val result: TopUpRequestedDetailJson
    result = TopUpRequestedDetailJson(
    )
    if (moneySet) {
      result.money = money
    }
    if (exchangedFromSet) {
      result.exchangedFrom = exchangedFrom
    }
    return result
  }

  public override fun toJson(writer: JsonWriter, value_: TopUpRequestedDetailJson?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("money")
    nullableMoneyAdapter.toJson(writer, value_.money)
    writer.name("exchangedFrom")
    nullableMoneyAdapter.toJson(writer, value_.exchangedFrom)
    writer.endObject()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy