org.http4k.connect.amazon.model.KotshiDataFormatConversionConfigurationJsonAdapter.kt Maven / Gradle / Ivy
The newest version!
// 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.Boolean
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 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 KotshiDataFormatConversionConfigurationJsonAdapter(
moshi: Moshi,
) : NamedJsonAdapter("KotshiJsonAdapter(DataFormatConversionConfiguration)") {
private val inputFormatConfigurationAdapter: JsonAdapter =
moshi.adapter(
InputFormatConfiguration::class.javaObjectType,
setOf(),
"InputFormatConfiguration"
)
private val outputFormatConfigurationAdapter: JsonAdapter =
moshi.adapter(
OutputFormatConfiguration::class.javaObjectType,
setOf(),
"OutputFormatConfiguration"
)
private val schemaConfigurationAdapter: JsonAdapter = moshi.adapter(
SchemaConfiguration::class.javaObjectType,
setOf(),
"SchemaConfiguration"
)
private val options: JsonReader.Options = JsonReader.Options.of(
"Enabled",
"InputFormatConfiguration",
"OutputFormatConfiguration",
"SchemaConfiguration"
)
@Volatile
private var defaultConstructor: Constructor? = null
@Throws(IOException::class)
override fun toJson(writer: JsonWriter, `value`: DataFormatConversionConfiguration?) {
if (`value` == null) {
writer.nullValue()
return
}
writer
.beginObject()
.name("Enabled").value(`value`.Enabled)
.name("InputFormatConfiguration").apply {
inputFormatConfigurationAdapter.toJson(this, `value`.InputFormatConfiguration)
}
.name("OutputFormatConfiguration").apply {
outputFormatConfigurationAdapter.toJson(this, `value`.OutputFormatConfiguration)
}
.name("SchemaConfiguration").apply {
schemaConfigurationAdapter.toJson(this, `value`.SchemaConfiguration)
}
.endObject()
}
@Throws(IOException::class)
override fun fromJson(reader: JsonReader): DataFormatConversionConfiguration? {
if (reader.peek() == JsonReader.Token.NULL) return reader.nextNull()
var mask = -1
var enabled: Boolean? = null
var inputFormatConfiguration: InputFormatConfiguration? = null
var outputFormatConfiguration: OutputFormatConfiguration? = null
var schemaConfiguration: SchemaConfiguration? = null
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
enabled = reader.nextBoolean()
}
// $mask = $mask and (1 shl 0).inv()
mask = mask and 0xfffffffe.toInt()
}
1 -> {
inputFormatConfiguration = inputFormatConfigurationAdapter.fromJson(reader)
// $mask = $mask and (1 shl 1).inv()
mask = mask and 0xfffffffd.toInt()
}
2 -> {
outputFormatConfiguration = outputFormatConfigurationAdapter.fromJson(reader)
// $mask = $mask and (1 shl 2).inv()
mask = mask and 0xfffffffb.toInt()
}
3 -> {
schemaConfiguration = schemaConfigurationAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask = mask and 0xfffffff7.toInt()
}
-1 -> {
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
return if (mask == 0xfffffff0.toInt()) {
DataFormatConversionConfiguration(
Enabled = enabled,
InputFormatConfiguration = inputFormatConfiguration,
OutputFormatConfiguration = outputFormatConfiguration,
SchemaConfiguration = schemaConfiguration
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor =
this.defaultConstructor ?: DataFormatConversionConfiguration::class.java.getDeclaredConstructor(
Boolean::class.javaObjectType,
InputFormatConfiguration::class.java,
OutputFormatConfiguration::class.java,
SchemaConfiguration::class.java,
Int::class.javaPrimitiveType,
DefaultConstructorMarker::class.java
).also { this.defaultConstructor = it }
localConstructor.newInstance(
enabled,
inputFormatConfiguration,
outputFormatConfiguration,
schemaConfiguration,
mask,
/* DefaultConstructorMarker */ null
)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy