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

tech.carpentum.sdk.payment.internal.generated.model.PayoutJsonJsonAdapter.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.PaymentRequested
import tech.carpentum.sdk.payment.model.PayoutMethod

public class PayoutJsonJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("paymentRequested",
      "paymentMethod", "callbackUrl", "customerIp")

  private val nullablePaymentRequestedAdapter: JsonAdapter =
      moshi.adapter(PaymentRequested::class.java, emptySet(), "paymentRequested")

  private val nullablePayoutMethodAdapter: JsonAdapter =
      moshi.adapter(PayoutMethod::class.java, emptySet(), "paymentMethod")

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

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

  public override fun fromJson(reader: JsonReader): PayoutJson {
    var paymentRequested: PaymentRequested? = null
    var paymentRequestedSet: Boolean = false
    var paymentMethod: PayoutMethod? = null
    var paymentMethodSet: Boolean = false
    var callbackUrl: String? = null
    var callbackUrlSet: Boolean = false
    var customerIp: String? = null
    var customerIpSet: Boolean = false
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          paymentRequested = nullablePaymentRequestedAdapter.fromJson(reader)
          paymentRequestedSet = true
        }
        1 -> {
          paymentMethod = nullablePayoutMethodAdapter.fromJson(reader)
          paymentMethodSet = true
        }
        2 -> {
          callbackUrl = nullableStringAdapter.fromJson(reader)
          callbackUrlSet = true
        }
        3 -> {
          customerIp = nullableStringAdapter.fromJson(reader)
          customerIpSet = true
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    val result: PayoutJson
    result = PayoutJson(
    )
    if (paymentRequestedSet) {
      result.paymentRequested = paymentRequested
    }
    if (paymentMethodSet) {
      result.paymentMethod = paymentMethod
    }
    if (callbackUrlSet) {
      result.callbackUrl = callbackUrl
    }
    if (customerIpSet) {
      result.customerIp = customerIp
    }
    return result
  }

  public override fun toJson(writer: JsonWriter, value_: PayoutJson?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("paymentRequested")
    nullablePaymentRequestedAdapter.toJson(writer, value_.paymentRequested)
    writer.name("paymentMethod")
    nullablePayoutMethodAdapter.toJson(writer, value_.paymentMethod)
    writer.name("callbackUrl")
    nullableStringAdapter.toJson(writer, value_.callbackUrl)
    writer.name("customerIp")
    nullableStringAdapter.toJson(writer, value_.customerIp)
    writer.endObject()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy