commonMain.aws.sdk.kotlin.services.sagemakergeospatial.serde.GeometryDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sagemakergeospatial-jvm Show documentation
Show all versions of sagemakergeospatial-jvm Show documentation
The AWS SDK for Kotlin client for SageMaker Geospatial
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.sagemakergeospatial.serde
import aws.sdk.kotlin.services.sagemakergeospatial.model.Geometry
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import kotlin.collections.mutableListOf
internal fun deserializeGeometryDocument(deserializer: Deserializer): Geometry {
val builder = Geometry.Builder()
val COORDINATES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Coordinates"))
val COORDINATES_C0_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List)
val COORDINATES_C1_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List)
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Type"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(COORDINATES_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
COORDINATES_DESCRIPTOR.index -> builder.coordinates =
deserializer.deserializeList(COORDINATES_DESCRIPTOR) {
val col0 = mutableListOf>>()
while (hasNextElement()) {
val el0 = deserializer.deserializeList(COORDINATES_C0_DESCRIPTOR) {
val col1 = mutableListOf>()
while (hasNextElement()) {
val el1 = deserializer.deserializeList(COORDINATES_C1_DESCRIPTOR) {
val col2 = mutableListOf()
while (hasNextElement()) {
val el2 = if (nextHasValue()) { deserializeDouble() } else { deserializeNull(); continue }
col2.add(el2)
}
col2
}
col1.add(el1)
}
col1
}
col0.add(el0)
}
col0
}
TYPE_DESCRIPTOR.index -> builder.type = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}