
org.http4k.connect.amazon.model.KotshiSplunkDestinationConfigurationJsonAdapter.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 java.util.UUID
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 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 KotshiSplunkDestinationConfigurationJsonAdapter(
moshi: Moshi,
) : NamedJsonAdapter("KotshiJsonAdapter(SplunkDestinationConfiguration)") {
private val hECEndpointTypeAdapter: JsonAdapter = moshi.adapter(
HECEndpointType::class.javaObjectType,
setOf(),
"HECEndpointType"
)
private val hECTokenAdapter: JsonAdapter = moshi.adapter(
UUID::class.javaObjectType,
setOf(),
"HECToken"
)
private val cloudWatchLoggingOptionsAdapter: JsonAdapter =
moshi.adapter(
CloudWatchLoggingOptions::class.javaObjectType,
setOf(),
"CloudWatchLoggingOptions"
)
private val processingConfigurationAdapter: JsonAdapter = moshi.adapter(
ProcessingConfiguration::class.javaObjectType,
setOf(),
"ProcessingConfiguration"
)
private val retryOptionsAdapter: JsonAdapter = moshi.adapter(
RetryOptions::class.javaObjectType,
setOf(),
"RetryOptions"
)
private val s3BackupModeAdapter: JsonAdapter = moshi.adapter(
SplunkS3BackupMode::class.javaObjectType,
setOf(),
"S3BackupMode"
)
private val s3ConfigurationAdapter: JsonAdapter = moshi.adapter(
S3DestinationConfiguration::class.javaObjectType,
setOf(),
"S3Configuration"
)
private val options: JsonReader.Options = JsonReader.Options.of(
"HECEndpoint",
"HECEndpointType",
"HECToken",
"CloudWatchLoggingOptions",
"HECAcknowledgmentTimeoutInSeconds",
"ProcessingConfiguration",
"RetryOptions",
"S3BackupMode",
"S3Configuration"
)
@Volatile
private var defaultConstructor: Constructor? = null
@Throws(IOException::class)
override fun toJson(writer: JsonWriter, `value`: SplunkDestinationConfiguration?) {
if (`value` == null) {
writer.nullValue()
return
}
writer
.beginObject()
.name("HECEndpoint").value(`value`.HECEndpoint)
.name("HECEndpointType").apply {
hECEndpointTypeAdapter.toJson(this, `value`.HECEndpointType)
}
.name("HECToken").apply {
hECTokenAdapter.toJson(this, `value`.HECToken)
}
.name("CloudWatchLoggingOptions").apply {
cloudWatchLoggingOptionsAdapter.toJson(this, `value`.CloudWatchLoggingOptions)
}
.name("HECAcknowledgmentTimeoutInSeconds").value(`value`.HECAcknowledgmentTimeoutInSeconds)
.name("ProcessingConfiguration").apply {
processingConfigurationAdapter.toJson(this, `value`.ProcessingConfiguration)
}
.name("RetryOptions").apply {
retryOptionsAdapter.toJson(this, `value`.RetryOptions)
}
.name("S3BackupMode").apply {
s3BackupModeAdapter.toJson(this, `value`.S3BackupMode)
}
.name("S3Configuration").apply {
s3ConfigurationAdapter.toJson(this, `value`.S3Configuration)
}
.endObject()
}
@Throws(IOException::class)
override fun fromJson(reader: JsonReader): SplunkDestinationConfiguration? {
if (reader.peek() == JsonReader.Token.NULL) return reader.nextNull()
var mask = -1
var hECEndpoint: String? = null
var hECEndpointType: HECEndpointType? = null
var hECToken: UUID? = null
var cloudWatchLoggingOptions: CloudWatchLoggingOptions? = null
var hECAcknowledgmentTimeoutInSeconds: Int? = null
var processingConfiguration: ProcessingConfiguration? = null
var retryOptions: RetryOptions? = null
var s3BackupMode: SplunkS3BackupMode? = null
var s3Configuration: S3DestinationConfiguration? = null
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
hECEndpoint = reader.nextString()
}
}
1 -> {
hECEndpointType = hECEndpointTypeAdapter.fromJson(reader)
}
2 -> {
hECToken = hECTokenAdapter.fromJson(reader)
}
3 -> {
cloudWatchLoggingOptions = cloudWatchLoggingOptionsAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask = mask and 0xfffffff7.toInt()
}
4 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
hECAcknowledgmentTimeoutInSeconds = reader.nextInt()
}
// $mask = $mask and (1 shl 4).inv()
mask = mask and 0xffffffef.toInt()
}
5 -> {
processingConfiguration = processingConfigurationAdapter.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 -> {
s3BackupMode = s3BackupModeAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask = mask and 0xffffff7f.toInt()
}
8 -> {
s3Configuration = s3ConfigurationAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask = mask and 0xfffffeff.toInt()
}
-1 -> {
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
var errorBuilder: StringBuilder? = null
if (hECEndpoint == null) {
errorBuilder = errorBuilder.appendNullableError("HECEndpoint")
}
if (hECEndpointType == null) {
errorBuilder = errorBuilder.appendNullableError("HECEndpointType")
}
if (hECToken == null) {
errorBuilder = errorBuilder.appendNullableError("HECToken")
}
if (errorBuilder != null) {
errorBuilder.append(" (at path ").append(reader.path).append(')')
throw JsonDataException(errorBuilder.toString())
}
return if (mask == 0xfffffe07.toInt()) {
SplunkDestinationConfiguration(
HECEndpoint = hECEndpoint!!,
HECEndpointType = hECEndpointType!!,
HECToken = hECToken!!,
CloudWatchLoggingOptions = cloudWatchLoggingOptions,
HECAcknowledgmentTimeoutInSeconds = hECAcknowledgmentTimeoutInSeconds,
ProcessingConfiguration = processingConfiguration,
RetryOptions = retryOptions,
S3BackupMode = s3BackupMode,
S3Configuration = s3Configuration
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor =
this.defaultConstructor ?: SplunkDestinationConfiguration::class.java.getDeclaredConstructor(
String::class.java,
HECEndpointType::class.java,
UUID::class.java,
CloudWatchLoggingOptions::class.java,
Int::class.javaObjectType,
ProcessingConfiguration::class.java,
RetryOptions::class.java,
SplunkS3BackupMode::class.java,
S3DestinationConfiguration::class.java,
Int::class.javaPrimitiveType,
DefaultConstructorMarker::class.java
).also { this.defaultConstructor = it }
localConstructor.newInstance(
hECEndpoint,
hECEndpointType,
hECToken,
cloudWatchLoggingOptions,
hECAcknowledgmentTimeoutInSeconds,
processingConfiguration,
retryOptions,
s3BackupMode,
s3Configuration,
mask,
/* DefaultConstructorMarker */ null
)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy