org.http4k.connect.amazon.model.KotshiOrcSerDeJsonAdapter.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 com.squareup.moshi.Types.newParameterizedType
import java.io.IOException
import java.lang.reflect.Constructor
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.apply
import kotlin.collections.List
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 KotshiOrcSerDeJsonAdapter(
moshi: Moshi,
) : NamedJsonAdapter("KotshiJsonAdapter(OrcSerDe)") {
private val bloomFilterColumnsAdapter: JsonAdapter?> = moshi.adapter(
newParameterizedType(List::class.javaObjectType, String::class.javaObjectType),
setOf(),
"BloomFilterColumns"
)
private val compressionAdapter: JsonAdapter = moshi.adapter(
Compression::class.javaObjectType,
setOf(),
"Compression"
)
private val formatVersionAdapter: JsonAdapter = moshi.adapter(
FormatVersion::class.javaObjectType,
setOf(),
"FormatVersion"
)
private val options: JsonReader.Options = JsonReader.Options.of(
"BlockSizeBytes",
"BloomFilterColumns",
"BloomFilterFalsePositiveProbability",
"Compression",
"DictionaryKeyThreshold",
"EnablePadding",
"FormatVersion",
"PaddingTolerance",
"RowIndexStride",
"StripeSizeBytes"
)
@Volatile
private var defaultConstructor: Constructor? = null
@Throws(IOException::class)
override fun toJson(writer: JsonWriter, `value`: OrcSerDe?) {
if (`value` == null) {
writer.nullValue()
return
}
writer
.beginObject()
.name("BlockSizeBytes").value(`value`.BlockSizeBytes)
.name("BloomFilterColumns").apply {
bloomFilterColumnsAdapter.toJson(this, `value`.BloomFilterColumns)
}
.name("BloomFilterFalsePositiveProbability").value(`value`.BloomFilterFalsePositiveProbability)
.name("Compression").apply {
compressionAdapter.toJson(this, `value`.Compression)
}
.name("DictionaryKeyThreshold").value(`value`.DictionaryKeyThreshold)
.name("EnablePadding").value(`value`.EnablePadding)
.name("FormatVersion").apply {
formatVersionAdapter.toJson(this, `value`.FormatVersion)
}
.name("PaddingTolerance").value(`value`.PaddingTolerance)
.name("RowIndexStride").value(`value`.RowIndexStride)
.name("StripeSizeBytes").value(`value`.StripeSizeBytes)
.endObject()
}
@Throws(IOException::class)
override fun fromJson(reader: JsonReader): OrcSerDe? {
if (reader.peek() == JsonReader.Token.NULL) return reader.nextNull()
var mask = -1
var blockSizeBytes: Int? = null
var bloomFilterColumns: List? = null
var bloomFilterFalsePositiveProbability: Int? = null
var compression: Compression? = null
var dictionaryKeyThreshold: Int? = null
var enablePadding: Boolean? = null
var formatVersion: FormatVersion? = null
var paddingTolerance: Int? = null
var rowIndexStride: Int? = null
var stripeSizeBytes: Int? = null
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
blockSizeBytes = reader.nextInt()
}
// $mask = $mask and (1 shl 0).inv()
mask = mask and 0xfffffffe.toInt()
}
1 -> {
bloomFilterColumns = bloomFilterColumnsAdapter.fromJson(reader)
// $mask = $mask and (1 shl 1).inv()
mask = mask and 0xfffffffd.toInt()
}
2 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
bloomFilterFalsePositiveProbability = reader.nextInt()
}
// $mask = $mask and (1 shl 2).inv()
mask = mask and 0xfffffffb.toInt()
}
3 -> {
compression = compressionAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask = mask and 0xfffffff7.toInt()
}
4 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
dictionaryKeyThreshold = reader.nextInt()
}
// $mask = $mask and (1 shl 4).inv()
mask = mask and 0xffffffef.toInt()
}
5 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
enablePadding = reader.nextBoolean()
}
// $mask = $mask and (1 shl 5).inv()
mask = mask and 0xffffffdf.toInt()
}
6 -> {
formatVersion = formatVersionAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask = mask and 0xffffffbf.toInt()
}
7 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
paddingTolerance = reader.nextInt()
}
// $mask = $mask and (1 shl 7).inv()
mask = mask and 0xffffff7f.toInt()
}
8 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
rowIndexStride = reader.nextInt()
}
// $mask = $mask and (1 shl 8).inv()
mask = mask and 0xfffffeff.toInt()
}
9 -> {
if (reader.peek() == JsonReader.Token.NULL) {
reader.skipValue()
} else {
stripeSizeBytes = reader.nextInt()
}
// $mask = $mask and (1 shl 9).inv()
mask = mask and 0xfffffdff.toInt()
}
-1 -> {
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
return if (mask == 0xfffffc00.toInt()) {
OrcSerDe(
BlockSizeBytes = blockSizeBytes,
BloomFilterColumns = bloomFilterColumns,
BloomFilterFalsePositiveProbability = bloomFilterFalsePositiveProbability,
Compression = compression,
DictionaryKeyThreshold = dictionaryKeyThreshold,
EnablePadding = enablePadding,
FormatVersion = formatVersion,
PaddingTolerance = paddingTolerance,
RowIndexStride = rowIndexStride,
StripeSizeBytes = stripeSizeBytes
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor =
this.defaultConstructor ?: OrcSerDe::class.java.getDeclaredConstructor(
Int::class.javaObjectType,
List::class.java,
Int::class.javaObjectType,
Compression::class.java,
Int::class.javaObjectType,
Boolean::class.javaObjectType,
FormatVersion::class.java,
Int::class.javaObjectType,
Int::class.javaObjectType,
Int::class.javaObjectType,
Int::class.javaPrimitiveType,
DefaultConstructorMarker::class.java
).also { this.defaultConstructor = it }
localConstructor.newInstance(
blockSizeBytes,
bloomFilterColumns,
bloomFilterFalsePositiveProbability,
compression,
dictionaryKeyThreshold,
enablePadding,
formatVersion,
paddingTolerance,
rowIndexStride,
stripeSizeBytes,
mask,
/* DefaultConstructorMarker */ null
)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy