All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.textract.serde.DocumentGroupDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.textract.serde

import aws.sdk.kotlin.services.textract.model.DetectedSignature
import aws.sdk.kotlin.services.textract.model.DocumentGroup
import aws.sdk.kotlin.services.textract.model.SplitDocument
import aws.sdk.kotlin.services.textract.model.UndetectedSignature
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 deserializeDocumentGroupDocument(deserializer: Deserializer): DocumentGroup {
    val builder = DocumentGroup.Builder()
    val DETECTEDSIGNATURES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("DetectedSignatures"))
    val SPLITDOCUMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("SplitDocuments"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Type"))
    val UNDETECTEDSIGNATURES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("UndetectedSignatures"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DETECTEDSIGNATURES_DESCRIPTOR)
        field(SPLITDOCUMENTS_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
        field(UNDETECTEDSIGNATURES_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                DETECTEDSIGNATURES_DESCRIPTOR.index -> builder.detectedSignatures =
                    deserializer.deserializeList(DETECTEDSIGNATURES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeDetectedSignatureDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                SPLITDOCUMENTS_DESCRIPTOR.index -> builder.splitDocuments =
                    deserializer.deserializeList(SPLITDOCUMENTS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeSplitDocumentDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString()
                UNDETECTEDSIGNATURES_DESCRIPTOR.index -> builder.undetectedSignatures =
                    deserializer.deserializeList(UNDETECTEDSIGNATURES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeUndetectedSignatureDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy