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

commonMain.aws.sdk.kotlin.services.glue.serde.FieldDocumentDeserializer.kt Maven / Gradle / Ivy

The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.glue.serde

import aws.sdk.kotlin.services.glue.model.Field
import aws.sdk.kotlin.services.glue.model.FieldDataType
import aws.sdk.kotlin.services.glue.model.FieldFilterOperator
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
import kotlin.collections.mutableMapOf

internal fun deserializeFieldDocument(deserializer: Deserializer): Field {
    val builder = Field.Builder()
    val CUSTOMPROPERTIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("CustomProperties"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val FIELDNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FieldName"))
    val FIELDTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("FieldType"))
    val ISCREATEABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsCreateable"))
    val ISDEFAULTONCREATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsDefaultOnCreate"))
    val ISFILTERABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsFilterable"))
    val ISNULLABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsNullable"))
    val ISPARTITIONABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsPartitionable"))
    val ISPRIMARYKEY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsPrimaryKey"))
    val ISRETRIEVABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsRetrievable"))
    val ISUPDATEABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsUpdateable"))
    val ISUPSERTABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsUpsertable"))
    val LABEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Label"))
    val NATIVEDATATYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("NativeDataType"))
    val PARENTFIELD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ParentField"))
    val SUPPORTEDFILTEROPERATORS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("SupportedFilterOperators"))
    val SUPPORTEDVALUES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("SupportedValues"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CUSTOMPROPERTIES_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(FIELDNAME_DESCRIPTOR)
        field(FIELDTYPE_DESCRIPTOR)
        field(ISCREATEABLE_DESCRIPTOR)
        field(ISDEFAULTONCREATE_DESCRIPTOR)
        field(ISFILTERABLE_DESCRIPTOR)
        field(ISNULLABLE_DESCRIPTOR)
        field(ISPARTITIONABLE_DESCRIPTOR)
        field(ISPRIMARYKEY_DESCRIPTOR)
        field(ISRETRIEVABLE_DESCRIPTOR)
        field(ISUPDATEABLE_DESCRIPTOR)
        field(ISUPSERTABLE_DESCRIPTOR)
        field(LABEL_DESCRIPTOR)
        field(NATIVEDATATYPE_DESCRIPTOR)
        field(PARENTFIELD_DESCRIPTOR)
        field(SUPPORTEDFILTEROPERATORS_DESCRIPTOR)
        field(SUPPORTEDVALUES_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CUSTOMPROPERTIES_DESCRIPTOR.index -> builder.customProperties =
                    deserializer.deserializeMap(CUSTOMPROPERTIES_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                FIELDNAME_DESCRIPTOR.index -> builder.fieldName = deserializeString()
                FIELDTYPE_DESCRIPTOR.index -> builder.fieldType = deserializeString().let { FieldDataType.fromValue(it) }
                ISCREATEABLE_DESCRIPTOR.index -> builder.isCreateable = deserializeBoolean()
                ISDEFAULTONCREATE_DESCRIPTOR.index -> builder.isDefaultOnCreate = deserializeBoolean()
                ISFILTERABLE_DESCRIPTOR.index -> builder.isFilterable = deserializeBoolean()
                ISNULLABLE_DESCRIPTOR.index -> builder.isNullable = deserializeBoolean()
                ISPARTITIONABLE_DESCRIPTOR.index -> builder.isPartitionable = deserializeBoolean()
                ISPRIMARYKEY_DESCRIPTOR.index -> builder.isPrimaryKey = deserializeBoolean()
                ISRETRIEVABLE_DESCRIPTOR.index -> builder.isRetrievable = deserializeBoolean()
                ISUPDATEABLE_DESCRIPTOR.index -> builder.isUpdateable = deserializeBoolean()
                ISUPSERTABLE_DESCRIPTOR.index -> builder.isUpsertable = deserializeBoolean()
                LABEL_DESCRIPTOR.index -> builder.label = deserializeString()
                NATIVEDATATYPE_DESCRIPTOR.index -> builder.nativeDataType = deserializeString()
                PARENTFIELD_DESCRIPTOR.index -> builder.parentField = deserializeString()
                SUPPORTEDFILTEROPERATORS_DESCRIPTOR.index -> builder.supportedFilterOperators =
                    deserializer.deserializeList(SUPPORTEDFILTEROPERATORS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { FieldFilterOperator.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                SUPPORTEDVALUES_DESCRIPTOR.index -> builder.supportedValues =
                    deserializer.deserializeList(SUPPORTEDVALUES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy