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

org.http4k.connect.amazon.model.KotshiHttpEndpointDestinationConfigurationJsonAdapter.kt Maven / Gradle / Ivy

// Code generated by Kotshi. Do not edit.
package org.http4k.connect.amazon.model

import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import java.io.IOException
import java.lang.reflect.Constructor
import kotlin.Int
import kotlin.Suppress
import kotlin.apply
import kotlin.collections.setOf
import kotlin.jvm.Throws
import kotlin.jvm.Volatile
import kotlin.jvm.`internal`.DefaultConstructorMarker
import org.http4k.connect.amazon.core.model.ARN
import se.ansman.kotshi.InternalKotshiApi
import se.ansman.kotshi.NamedJsonAdapter

@InternalKotshiApi
@Suppress(
  "DEPRECATION",
  "unused",
  "ClassName",
  "REDUNDANT_PROJECTION",
  "RedundantExplicitType",
  "LocalVariableName",
  "RedundantVisibilityModifier",
  "PLATFORM_CLASS_MAPPED_TO_KOTLIN",
  "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION",
  "EXPERIMENTAL_API_USAGE",
  "OPT_IN_USAGE",
)
internal class KotshiHttpEndpointDestinationConfigurationJsonAdapter(
  moshi: Moshi,
) : NamedJsonAdapter("KotshiJsonAdapter(HttpEndpointDestinationConfiguration)") {
  private val s3ConfigurationAdapter: JsonAdapter = moshi.adapter(
      S3DestinationConfiguration::class.javaObjectType,
      setOf(),
      "S3Configuration"
  )

  private val bufferingHintsAdapter: JsonAdapter = moshi.adapter(
      BufferingHints::class.javaObjectType,
      setOf(),
      "BufferingHints"
  )

  private val cloudWatchLoggingOptionsAdapter: JsonAdapter =
      moshi.adapter(
      CloudWatchLoggingOptions::class.javaObjectType,
      setOf(),
      "CloudWatchLoggingOptions"
  )

  private val endpointConfigurationAdapter: JsonAdapter = moshi.adapter(
      EndpointConfiguration::class.javaObjectType,
      setOf(),
      "EndpointConfiguration"
  )

  private val processingConfigurationAdapter: JsonAdapter = moshi.adapter(
      ProcessingConfiguration::class.javaObjectType,
      setOf(),
      "ProcessingConfiguration"
  )

  private val requestConfigurationAdapter: JsonAdapter = moshi.adapter(
      RequestConfiguration::class.javaObjectType,
      setOf(),
      "RequestConfiguration"
  )

  private val retryOptionsAdapter: JsonAdapter = moshi.adapter(
      RetryOptions::class.javaObjectType,
      setOf(),
      "RetryOptions"
  )

  private val roleARNAdapter: JsonAdapter = moshi.adapter(
      ARN::class.javaObjectType,
      setOf(),
      "RoleARN"
  )

  private val s3BackupModeAdapter: JsonAdapter = moshi.adapter(
      S3BackupMode::class.javaObjectType,
      setOf(),
      "S3BackupMode"
  )

  private val options: JsonReader.Options = JsonReader.Options.of(
      "S3Configuration",
      "BufferingHints",
      "CloudWatchLoggingOptions",
      "EndpointConfiguration",
      "ProcessingConfiguration",
      "RequestConfiguration",
      "RetryOptions",
      "RoleARN",
      "S3BackupMode"
  )

  @Volatile
  private var defaultConstructor: Constructor? = null

  @Throws(IOException::class)
  override fun toJson(writer: JsonWriter, `value`: HttpEndpointDestinationConfiguration?) {
    if (`value` == null) {
      writer.nullValue()
      return
    }
    writer
      .beginObject()
      .name("S3Configuration").apply {
        s3ConfigurationAdapter.toJson(this, `value`.S3Configuration)
      }
      .name("BufferingHints").apply {
        bufferingHintsAdapter.toJson(this, `value`.BufferingHints)
      }
      .name("CloudWatchLoggingOptions").apply {
        cloudWatchLoggingOptionsAdapter.toJson(this, `value`.CloudWatchLoggingOptions)
      }
      .name("EndpointConfiguration").apply {
        endpointConfigurationAdapter.toJson(this, `value`.EndpointConfiguration)
      }
      .name("ProcessingConfiguration").apply {
        processingConfigurationAdapter.toJson(this, `value`.ProcessingConfiguration)
      }
      .name("RequestConfiguration").apply {
        requestConfigurationAdapter.toJson(this, `value`.RequestConfiguration)
      }
      .name("RetryOptions").apply {
        retryOptionsAdapter.toJson(this, `value`.RetryOptions)
      }
      .name("RoleARN").apply {
        roleARNAdapter.toJson(this, `value`.RoleARN)
      }
      .name("S3BackupMode").apply {
        s3BackupModeAdapter.toJson(this, `value`.S3BackupMode)
      }
      .endObject()
  }

  @Throws(IOException::class)
  override fun fromJson(reader: JsonReader): HttpEndpointDestinationConfiguration? {
    if (reader.peek() == JsonReader.Token.NULL) return reader.nextNull()

    var mask = -1
    var s3Configuration: S3DestinationConfiguration? = null
    var bufferingHints: BufferingHints? = null
    var cloudWatchLoggingOptions: CloudWatchLoggingOptions? = null
    var endpointConfiguration: EndpointConfiguration? = null
    var processingConfiguration: ProcessingConfiguration? = null
    var requestConfiguration: RequestConfiguration? = null
    var retryOptions: RetryOptions? = null
    var roleARN: ARN? = null
    var s3BackupMode: S3BackupMode? = null

    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          s3Configuration = s3ConfigurationAdapter.fromJson(reader)
        }
        1 -> {
          bufferingHints = bufferingHintsAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 1).inv()
          mask = mask and 0xfffffffd.toInt()
        }
        2 -> {
          cloudWatchLoggingOptions = cloudWatchLoggingOptionsAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 2).inv()
          mask = mask and 0xfffffffb.toInt()
        }
        3 -> {
          endpointConfiguration = endpointConfigurationAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 3).inv()
          mask = mask and 0xfffffff7.toInt()
        }
        4 -> {
          processingConfiguration = processingConfigurationAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 4).inv()
          mask = mask and 0xffffffef.toInt()
        }
        5 -> {
          requestConfiguration = requestConfigurationAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 5).inv()
          mask = mask and 0xffffffdf.toInt()
        }
        6 -> {
          retryOptions = retryOptionsAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 6).inv()
          mask = mask and 0xffffffbf.toInt()
        }
        7 -> {
          roleARN = roleARNAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 7).inv()
          mask = mask and 0xffffff7f.toInt()
        }
        8 -> {
          s3BackupMode = s3BackupModeAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 8).inv()
          mask = mask and 0xfffffeff.toInt()
        }
        -1 -> {
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()

    return if (mask == 0xfffffe01.toInt()) {
      HttpEndpointDestinationConfiguration(
          S3Configuration = s3Configuration,
          BufferingHints = bufferingHints,
          CloudWatchLoggingOptions = cloudWatchLoggingOptions,
          EndpointConfiguration = endpointConfiguration,
          ProcessingConfiguration = processingConfiguration,
          RequestConfiguration = requestConfiguration,
          RetryOptions = retryOptions,
          RoleARN = roleARN,
          S3BackupMode = s3BackupMode
      )
    } else {
      // Reflectively invoke the synthetic defaults constructor
      @Suppress("UNCHECKED_CAST")
      val localConstructor: Constructor =
          this.defaultConstructor ?: HttpEndpointDestinationConfiguration::class.java.getDeclaredConstructor(
            S3DestinationConfiguration::class.java,
            BufferingHints::class.java,
            CloudWatchLoggingOptions::class.java,
            EndpointConfiguration::class.java,
            ProcessingConfiguration::class.java,
            RequestConfiguration::class.java,
            RetryOptions::class.java,
            ARN::class.java,
            S3BackupMode::class.java,
            Int::class.javaPrimitiveType,
            DefaultConstructorMarker::class.java
          ).also { this.defaultConstructor = it }
      localConstructor.newInstance(
          s3Configuration,
          bufferingHints,
          cloudWatchLoggingOptions,
          endpointConfiguration,
          processingConfiguration,
          requestConfiguration,
          retryOptions,
          roleARN,
          s3BackupMode,
          mask,
          /* DefaultConstructorMarker */ null
      )
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy