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

org.http4k.connect.amazon.model.KotshiExtendedS3DestinationConfigurationJsonAdapter.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.JsonDataException
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import java.io.IOException
import java.lang.StringBuilder
import java.lang.reflect.Constructor
import kotlin.Int
import kotlin.String
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.KotshiUtils.appendNullableError
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 KotshiExtendedS3DestinationConfigurationJsonAdapter(
  moshi: Moshi,
) : NamedJsonAdapter("KotshiJsonAdapter(ExtendedS3DestinationConfiguration)") {
  private val bucketARNAdapter: JsonAdapter = moshi.adapter(
      ARN::class.javaObjectType,
      setOf(),
      "BucketARN"
  )

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

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

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

  private val compressionFormatAdapter: JsonAdapter = moshi.adapter(
      CompressionFormat::class.javaObjectType,
      setOf(),
      "CompressionFormat"
  )

  private val dataFormatConversionConfigurationAdapter:
      JsonAdapter = moshi.adapter(
      DataFormatConversionConfiguration::class.javaObjectType,
      setOf(),
      "DataFormatConversionConfiguration"
  )

  private val encryptionConfigurationAdapter: JsonAdapter = moshi.adapter(
      EncryptionConfiguration::class.javaObjectType,
      setOf(),
      "EncryptionConfiguration"
  )

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

  private val s3BackupConfigurationAdapter: JsonAdapter = moshi.adapter(
      S3BackupConfiguration::class.javaObjectType,
      setOf(),
      "S3BackupConfiguration"
  )

  private val options: JsonReader.Options = JsonReader.Options.of(
      "BucketARN",
      "RoleARN",
      "BufferingHints",
      "CloudWatchLoggingOptions",
      "CompressionFormat",
      "DataFormatConversionConfiguration",
      "EncryptionConfiguration",
      "ErrorOutputPrefix",
      "Prefix",
      "ProcessingConfiguration",
      "S3BackupConfiguration",
      "S3BackupMode"
  )

  @Volatile
  private var defaultConstructor: Constructor? = null

  @Throws(IOException::class)
  override fun toJson(writer: JsonWriter, `value`: ExtendedS3DestinationConfiguration?) {
    if (`value` == null) {
      writer.nullValue()
      return
    }
    writer
      .beginObject()
      .name("BucketARN").apply {
        bucketARNAdapter.toJson(this, `value`.BucketARN)
      }
      .name("RoleARN").apply {
        roleARNAdapter.toJson(this, `value`.RoleARN)
      }
      .name("BufferingHints").apply {
        bufferingHintsAdapter.toJson(this, `value`.BufferingHints)
      }
      .name("CloudWatchLoggingOptions").apply {
        cloudWatchLoggingOptionsAdapter.toJson(this, `value`.CloudWatchLoggingOptions)
      }
      .name("CompressionFormat").apply {
        compressionFormatAdapter.toJson(this, `value`.CompressionFormat)
      }
      .name("DataFormatConversionConfiguration").apply {
        dataFormatConversionConfigurationAdapter.toJson(this, `value`.DataFormatConversionConfiguration)
      }
      .name("EncryptionConfiguration").apply {
        encryptionConfigurationAdapter.toJson(this, `value`.EncryptionConfiguration)
      }
      .name("ErrorOutputPrefix").value(`value`.ErrorOutputPrefix)
      .name("Prefix").value(`value`.Prefix)
      .name("ProcessingConfiguration").apply {
        processingConfigurationAdapter.toJson(this, `value`.ProcessingConfiguration)
      }
      .name("S3BackupConfiguration").apply {
        s3BackupConfigurationAdapter.toJson(this, `value`.S3BackupConfiguration)
      }
      .name("S3BackupMode").value(`value`.S3BackupMode)
      .endObject()
  }

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

    var mask = -1
    var bucketARN: ARN? = null
    var roleARN: ARN? = null
    var bufferingHints: BufferingHints? = null
    var cloudWatchLoggingOptions: CloudWatchLoggingOptions? = null
    var compressionFormat: CompressionFormat? = null
    var dataFormatConversionConfiguration: DataFormatConversionConfiguration? = null
    var encryptionConfiguration: EncryptionConfiguration? = null
    var errorOutputPrefix: String? = null
    var prefix: String? = null
    var processingConfiguration: ProcessingConfiguration? = null
    var s3BackupConfiguration: S3BackupConfiguration? = null
    var s3BackupMode: String? = null

    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          bucketARN = bucketARNAdapter.fromJson(reader)
        }
        1 -> {
          roleARN = roleARNAdapter.fromJson(reader)
        }
        2 -> {
          bufferingHints = bufferingHintsAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 2).inv()
          mask = mask and 0xfffffffb.toInt()
        }
        3 -> {
          cloudWatchLoggingOptions = cloudWatchLoggingOptionsAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 3).inv()
          mask = mask and 0xfffffff7.toInt()
        }
        4 -> {
          compressionFormat = compressionFormatAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 4).inv()
          mask = mask and 0xffffffef.toInt()
        }
        5 -> {
          dataFormatConversionConfiguration = dataFormatConversionConfigurationAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 5).inv()
          mask = mask and 0xffffffdf.toInt()
        }
        6 -> {
          encryptionConfiguration = encryptionConfigurationAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 6).inv()
          mask = mask and 0xffffffbf.toInt()
        }
        7 -> {
          if (reader.peek() == JsonReader.Token.NULL) {
            reader.skipValue()
          } else {
            errorOutputPrefix = reader.nextString()
          }
          // $mask = $mask and (1 shl 7).inv()
          mask = mask and 0xffffff7f.toInt()
        }
        8 -> {
          if (reader.peek() == JsonReader.Token.NULL) {
            reader.skipValue()
          } else {
            prefix = reader.nextString()
          }
          // $mask = $mask and (1 shl 8).inv()
          mask = mask and 0xfffffeff.toInt()
        }
        9 -> {
          processingConfiguration = processingConfigurationAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 9).inv()
          mask = mask and 0xfffffdff.toInt()
        }
        10 -> {
          s3BackupConfiguration = s3BackupConfigurationAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 10).inv()
          mask = mask and 0xfffffbff.toInt()
        }
        11 -> {
          if (reader.peek() == JsonReader.Token.NULL) {
            reader.skipValue()
          } else {
            s3BackupMode = reader.nextString()
          }
          // $mask = $mask and (1 shl 11).inv()
          mask = mask and 0xfffff7ff.toInt()
        }
        -1 -> {
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()

    var errorBuilder: StringBuilder? = null
    if (bucketARN == null) {
      errorBuilder = errorBuilder.appendNullableError("BucketARN")
    }
    if (roleARN == null) {
      errorBuilder = errorBuilder.appendNullableError("RoleARN")
    }
    if (errorBuilder != null) {
      errorBuilder.append(" (at path ").append(reader.path).append(')')
      throw JsonDataException(errorBuilder.toString())
    }

    return if (mask == 0xfffff003.toInt()) {
      ExtendedS3DestinationConfiguration(
          BucketARN = bucketARN!!,
          RoleARN = roleARN!!,
          BufferingHints = bufferingHints,
          CloudWatchLoggingOptions = cloudWatchLoggingOptions,
          CompressionFormat = compressionFormat,
          DataFormatConversionConfiguration = dataFormatConversionConfiguration,
          EncryptionConfiguration = encryptionConfiguration,
          ErrorOutputPrefix = errorOutputPrefix,
          Prefix = prefix,
          ProcessingConfiguration = processingConfiguration,
          S3BackupConfiguration = s3BackupConfiguration,
          S3BackupMode = s3BackupMode
      )
    } else {
      // Reflectively invoke the synthetic defaults constructor
      @Suppress("UNCHECKED_CAST")
      val localConstructor: Constructor =
          this.defaultConstructor ?: ExtendedS3DestinationConfiguration::class.java.getDeclaredConstructor(
            ARN::class.java,
            ARN::class.java,
            BufferingHints::class.java,
            CloudWatchLoggingOptions::class.java,
            CompressionFormat::class.java,
            DataFormatConversionConfiguration::class.java,
            EncryptionConfiguration::class.java,
            String::class.java,
            String::class.java,
            ProcessingConfiguration::class.java,
            S3BackupConfiguration::class.java,
            String::class.java,
            Int::class.javaPrimitiveType,
            DefaultConstructorMarker::class.java
          ).also { this.defaultConstructor = it }
      localConstructor.newInstance(
          bucketARN,
          roleARN,
          bufferingHints,
          cloudWatchLoggingOptions,
          compressionFormat,
          dataFormatConversionConfiguration,
          encryptionConfiguration,
          errorOutputPrefix,
          prefix,
          processingConfiguration,
          s3BackupConfiguration,
          s3BackupMode,
          mask,
          /* DefaultConstructorMarker */ null
      )
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy