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

commonMain.aws.sdk.kotlin.services.iotfleetwise.serde.ActuatorDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.iotfleetwise.serde

import aws.sdk.kotlin.services.iotfleetwise.model.Actuator
import aws.sdk.kotlin.services.iotfleetwise.model.NodeDataType
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 deserializeActuatorDocument(deserializer: Deserializer): Actuator {
    val builder = Actuator.Builder()
    val ALLOWEDVALUES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("allowedValues"))
    val ASSIGNEDVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("assignedValue"))
    val COMMENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("comment"))
    val DATATYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("dataType"))
    val DEPRECATIONMESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("deprecationMessage"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
    val FULLYQUALIFIEDNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("fullyQualifiedName"))
    val MAX_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("max"))
    val MIN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("min"))
    val STRUCTFULLYQUALIFIEDNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("structFullyQualifiedName"))
    val UNIT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("unit"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ALLOWEDVALUES_DESCRIPTOR)
        field(ASSIGNEDVALUE_DESCRIPTOR)
        field(COMMENT_DESCRIPTOR)
        field(DATATYPE_DESCRIPTOR)
        field(DEPRECATIONMESSAGE_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(FULLYQUALIFIEDNAME_DESCRIPTOR)
        field(MAX_DESCRIPTOR)
        field(MIN_DESCRIPTOR)
        field(STRUCTFULLYQUALIFIEDNAME_DESCRIPTOR)
        field(UNIT_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ALLOWEDVALUES_DESCRIPTOR.index -> builder.allowedValues =
                    deserializer.deserializeList(ALLOWEDVALUES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ASSIGNEDVALUE_DESCRIPTOR.index -> builder.assignedValue = deserializeString()
                COMMENT_DESCRIPTOR.index -> builder.comment = deserializeString()
                DATATYPE_DESCRIPTOR.index -> builder.dataType = deserializeString().let { NodeDataType.fromValue(it) }
                DEPRECATIONMESSAGE_DESCRIPTOR.index -> builder.deprecationMessage = deserializeString()
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                FULLYQUALIFIEDNAME_DESCRIPTOR.index -> builder.fullyQualifiedName = deserializeString()
                MAX_DESCRIPTOR.index -> builder.max = deserializeDouble()
                MIN_DESCRIPTOR.index -> builder.min = deserializeDouble()
                STRUCTFULLYQUALIFIEDNAME_DESCRIPTOR.index -> builder.structFullyQualifiedName = deserializeString()
                UNIT_DESCRIPTOR.index -> builder.unit = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy