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

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

The 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.IdPayment
import tech.carpentum.sdk.payment.model.IdPayout

public class WalletTransferMethodResponseJsonJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("idPayout", "idPayment",
      "paymentMethodCode", "reference")

  private val nullableIdPayoutAdapter: JsonAdapter = moshi.adapter(IdPayout::class.java,
      emptySet(), "idPayout")

  private val nullableIdPaymentAdapter: JsonAdapter =
      moshi.adapter(IdPayment::class.java, emptySet(), "idPayment")

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

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

  public override fun fromJson(reader: JsonReader): WalletTransferMethodResponseJson {
    var idPayout: IdPayout? = null
    var idPayoutSet: Boolean = false
    var idPayment: IdPayment? = null
    var idPaymentSet: Boolean = false
    var paymentMethodCode: String? = null
    var paymentMethodCodeSet: Boolean = false
    var reference: String? = null
    var referenceSet: Boolean = false
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          idPayout = nullableIdPayoutAdapter.fromJson(reader)
          idPayoutSet = true
        }
        1 -> {
          idPayment = nullableIdPaymentAdapter.fromJson(reader)
          idPaymentSet = true
        }
        2 -> {
          paymentMethodCode = nullableStringAdapter.fromJson(reader)
          paymentMethodCodeSet = true
        }
        3 -> {
          reference = nullableStringAdapter.fromJson(reader)
          referenceSet = true
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    val result: WalletTransferMethodResponseJson
    result = WalletTransferMethodResponseJson(
    )
    if (idPayoutSet) {
      result.idPayout = idPayout
    }
    if (idPaymentSet) {
      result.idPayment = idPayment
    }
    if (paymentMethodCodeSet) {
      result.paymentMethodCode = paymentMethodCode
    }
    if (referenceSet) {
      result.reference = reference
    }
    return result
  }

  public override fun toJson(writer: JsonWriter, value_: WalletTransferMethodResponseJson?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("idPayout")
    nullableIdPayoutAdapter.toJson(writer, value_.idPayout)
    writer.name("idPayment")
    nullableIdPaymentAdapter.toJson(writer, value_.idPayment)
    writer.name("paymentMethodCode")
    nullableStringAdapter.toJson(writer, value_.paymentMethodCode)
    writer.name("reference")
    nullableStringAdapter.toJson(writer, value_.reference)
    writer.endObject()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy