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

tech.carpentum.sdk.payment.internal.generated.model.TopUpJsonJsonAdapter.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.PayinMethod
import tech.carpentum.sdk.payment.model.TopUpRequested

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

  private val nullableTopUpRequestedAdapter: JsonAdapter =
      moshi.adapter(TopUpRequested::class.java, emptySet(), "topUpRequested")

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

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

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

  public override fun fromJson(reader: JsonReader): TopUpJson {
    var topUpRequested: TopUpRequested? = null
    var topUpRequestedSet: Boolean = false
    var paymentMethod: PayinMethod? = null
    var paymentMethodSet: Boolean = false
    var callbackUrl: String? = null
    var callbackUrlSet: Boolean = false
    var returnUrl: String? = null
    var returnUrlSet: Boolean = false
    var customerIp: String? = null
    var customerIpSet: Boolean = false
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          topUpRequested = nullableTopUpRequestedAdapter.fromJson(reader)
          topUpRequestedSet = true
        }
        1 -> {
          paymentMethod = nullablePayinMethodAdapter.fromJson(reader)
          paymentMethodSet = true
        }
        2 -> {
          callbackUrl = nullableStringAdapter.fromJson(reader)
          callbackUrlSet = true
        }
        3 -> {
          returnUrl = nullableStringAdapter.fromJson(reader)
          returnUrlSet = true
        }
        4 -> {
          customerIp = nullableStringAdapter.fromJson(reader)
          customerIpSet = true
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    val result: TopUpJson
    result = TopUpJson(
    )
    if (topUpRequestedSet) {
      result.topUpRequested = topUpRequested
    }
    if (paymentMethodSet) {
      result.paymentMethod = paymentMethod
    }
    if (callbackUrlSet) {
      result.callbackUrl = callbackUrl
    }
    if (returnUrlSet) {
      result.returnUrl = returnUrl
    }
    if (customerIpSet) {
      result.customerIp = customerIp
    }
    return result
  }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy