org.http4k.connect.amazon.model.KotshiCopyCommandJsonAdapter.kt Maven / Gradle / Ivy
The newest version!
// Code generated by Kotshi. Do not edit.
package org.http4k.connect.amazon.model
import com.squareup.moshi.JsonDataException
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import java.io.IOException
import java.lang.StringBuilder
import java.lang.reflect.Constructor
import kotlin.Int
import kotlin.String
import kotlin.Suppress
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 KotshiCopyCommandJsonAdapter() : NamedJsonAdapter("KotshiJsonAdapter(CopyCommand)") {
private val options: JsonReader.Options = JsonReader.Options.of(
"DataTableName",
"CopyOptions",
"DataTableColumns"
)
@Volatile
private var defaultConstructor: Constructor? = null
@Throws(IOException::class)
override fun toJson(writer: JsonWriter, `value`: CopyCommand?) {
if (`value` == null) {
writer.nullValue()
return
}
writer
.beginObject()
.name("DataTableName").value(`value`.DataTableName)
.name("CopyOptions").value(`value`.CopyOptions)
.name("DataTableColumns").value(`value`.DataTableColumns)
.endObject()
}
@Throws(IOException::class)
override fun fromJson(reader: JsonReader): CopyCommand? {
if (reader.peek() == JsonReader.Token.NULL) return reader.nextNull()
var mask = -1
var dataTableName: String? = null
var copyOptions: String? = null
var dataTableColumns: String? = null
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
dataTableName = reader.nextString()
}
}
1 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
copyOptions = reader.nextString()
}
// $mask = $mask and (1 shl 1).inv()
mask = mask and 0xfffffffd.toInt()
}
2 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
dataTableColumns = reader.nextString()
}
// $mask = $mask and (1 shl 2).inv()
mask = mask and 0xfffffffb.toInt()
}
-1 -> {
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
var errorBuilder: StringBuilder? = null
if (dataTableName == null) {
errorBuilder = errorBuilder.appendNullableError("DataTableName")
}
if (errorBuilder != null) {
errorBuilder.append(" (at path ").append(reader.path).append(')')
throw JsonDataException(errorBuilder.toString())
}
return if (mask == 0xfffffff9.toInt()) {
CopyCommand(
DataTableName = dataTableName!!,
CopyOptions = copyOptions,
DataTableColumns = dataTableColumns
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor =
this.defaultConstructor ?: CopyCommand::class.java.getDeclaredConstructor(
String::class.java,
String::class.java,
String::class.java,
Int::class.javaPrimitiveType,
DefaultConstructorMarker::class.java
).also { this.defaultConstructor = it }
localConstructor.newInstance(
dataTableName,
copyOptions,
dataTableColumns,
mask,
/* DefaultConstructorMarker */ null
)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy