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

tech.carpentum.sdk.payment.internal.generated.model.PaymentProcessJsonJsonAdapter.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 java.time.OffsetDateTime
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.FailureReasons
import tech.carpentum.sdk.payment.model.PaymentStatus
import tech.carpentum.sdk.payment.model.ProcessorStatus

public class PaymentProcessJsonJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("status", "failureReasons",
      "createdAt", "processedAt", "isTest", "processorStatus")

  private val nullablePaymentStatusAdapter: JsonAdapter =
      moshi.adapter(PaymentStatus::class.java, emptySet(), "status")

  private val nullableFailureReasonsAdapter: JsonAdapter =
      moshi.adapter(FailureReasons::class.java, emptySet(), "failureReasons")

  private val nullableOffsetDateTimeAdapter: JsonAdapter =
      moshi.adapter(OffsetDateTime::class.java, emptySet(), "createdAt")

  private val nullableBooleanAdapter: JsonAdapter =
      moshi.adapter(Boolean::class.javaObjectType, emptySet(), "isTest")

  private val nullableProcessorStatusAdapter: JsonAdapter =
      moshi.adapter(ProcessorStatus::class.java, emptySet(), "processorStatus")

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

  public override fun fromJson(reader: JsonReader): PaymentProcessJson {
    var status: PaymentStatus? = null
    var statusSet: Boolean = false
    var failureReasons: FailureReasons? = null
    var failureReasonsSet: Boolean = false
    var createdAt: OffsetDateTime? = null
    var createdAtSet: Boolean = false
    var processedAt: OffsetDateTime? = null
    var processedAtSet: Boolean = false
    var isTest: Boolean? = null
    var isTestSet: Boolean = false
    var processorStatus: ProcessorStatus? = null
    var processorStatusSet: Boolean = false
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          status = nullablePaymentStatusAdapter.fromJson(reader)
          statusSet = true
        }
        1 -> {
          failureReasons = nullableFailureReasonsAdapter.fromJson(reader)
          failureReasonsSet = true
        }
        2 -> {
          createdAt = nullableOffsetDateTimeAdapter.fromJson(reader)
          createdAtSet = true
        }
        3 -> {
          processedAt = nullableOffsetDateTimeAdapter.fromJson(reader)
          processedAtSet = true
        }
        4 -> {
          isTest = nullableBooleanAdapter.fromJson(reader)
          isTestSet = true
        }
        5 -> {
          processorStatus = nullableProcessorStatusAdapter.fromJson(reader)
          processorStatusSet = true
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    val result: PaymentProcessJson
    result = PaymentProcessJson(
    )
    if (statusSet) {
      result.status = status
    }
    if (failureReasonsSet) {
      result.failureReasons = failureReasons
    }
    if (createdAtSet) {
      result.createdAt = createdAt
    }
    if (processedAtSet) {
      result.processedAt = processedAt
    }
    if (isTestSet) {
      result.isTest = isTest
    }
    if (processorStatusSet) {
      result.processorStatus = processorStatus
    }
    return result
  }

  public override fun toJson(writer: JsonWriter, value_: PaymentProcessJson?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("status")
    nullablePaymentStatusAdapter.toJson(writer, value_.status)
    writer.name("failureReasons")
    nullableFailureReasonsAdapter.toJson(writer, value_.failureReasons)
    writer.name("createdAt")
    nullableOffsetDateTimeAdapter.toJson(writer, value_.createdAt)
    writer.name("processedAt")
    nullableOffsetDateTimeAdapter.toJson(writer, value_.processedAt)
    writer.name("isTest")
    nullableBooleanAdapter.toJson(writer, value_.isTest)
    writer.name("processorStatus")
    nullableProcessorStatusAdapter.toJson(writer, value_.processorStatus)
    writer.endObject()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy