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

commonMain.aws.sdk.kotlin.services.snowball.serde.AddressDocumentDeserializer.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.snowball.serde

import aws.sdk.kotlin.services.snowball.model.Address
import aws.sdk.kotlin.services.snowball.model.AddressType
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

internal fun deserializeAddressDocument(deserializer: Deserializer): Address {
    val builder = Address.Builder()
    val ADDRESSID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AddressId"))
    val CITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("City"))
    val COMPANY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Company"))
    val COUNTRY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Country"))
    val ISRESTRICTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsRestricted"))
    val LANDMARK_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Landmark"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val PHONENUMBER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PhoneNumber"))
    val POSTALCODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PostalCode"))
    val PREFECTUREORDISTRICT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PrefectureOrDistrict"))
    val STATEORPROVINCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StateOrProvince"))
    val STREET1_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Street1"))
    val STREET2_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Street2"))
    val STREET3_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Street3"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Type"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ADDRESSID_DESCRIPTOR)
        field(CITY_DESCRIPTOR)
        field(COMPANY_DESCRIPTOR)
        field(COUNTRY_DESCRIPTOR)
        field(ISRESTRICTED_DESCRIPTOR)
        field(LANDMARK_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(PHONENUMBER_DESCRIPTOR)
        field(POSTALCODE_DESCRIPTOR)
        field(PREFECTUREORDISTRICT_DESCRIPTOR)
        field(STATEORPROVINCE_DESCRIPTOR)
        field(STREET1_DESCRIPTOR)
        field(STREET2_DESCRIPTOR)
        field(STREET3_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ADDRESSID_DESCRIPTOR.index -> builder.addressId = deserializeString()
                CITY_DESCRIPTOR.index -> builder.city = deserializeString()
                COMPANY_DESCRIPTOR.index -> builder.company = deserializeString()
                COUNTRY_DESCRIPTOR.index -> builder.country = deserializeString()
                ISRESTRICTED_DESCRIPTOR.index -> builder.isRestricted = deserializeBoolean()
                LANDMARK_DESCRIPTOR.index -> builder.landmark = deserializeString()
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                PHONENUMBER_DESCRIPTOR.index -> builder.phoneNumber = deserializeString()
                POSTALCODE_DESCRIPTOR.index -> builder.postalCode = deserializeString()
                PREFECTUREORDISTRICT_DESCRIPTOR.index -> builder.prefectureOrDistrict = deserializeString()
                STATEORPROVINCE_DESCRIPTOR.index -> builder.stateOrProvince = deserializeString()
                STREET1_DESCRIPTOR.index -> builder.street1 = deserializeString()
                STREET2_DESCRIPTOR.index -> builder.street2 = deserializeString()
                STREET3_DESCRIPTOR.index -> builder.street3 = deserializeString()
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { AddressType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy