commonMain.aws.sdk.kotlin.services.translate.serde.TranslationSettingsDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of translate-jvm Show documentation
Show all versions of translate-jvm Show documentation
The AWS SDK for Kotlin client for Translate
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.translate.serde
import aws.sdk.kotlin.services.translate.model.Brevity
import aws.sdk.kotlin.services.translate.model.Formality
import aws.sdk.kotlin.services.translate.model.Profanity
import aws.sdk.kotlin.services.translate.model.TranslationSettings
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 deserializeTranslationSettingsDocument(deserializer: Deserializer): TranslationSettings {
val builder = TranslationSettings.Builder()
val BREVITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Brevity"))
val FORMALITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Formality"))
val PROFANITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Profanity"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(BREVITY_DESCRIPTOR)
field(FORMALITY_DESCRIPTOR)
field(PROFANITY_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
BREVITY_DESCRIPTOR.index -> builder.brevity = deserializeString().let { Brevity.fromValue(it) }
FORMALITY_DESCRIPTOR.index -> builder.formality = deserializeString().let { Formality.fromValue(it) }
PROFANITY_DESCRIPTOR.index -> builder.profanity = deserializeString().let { Profanity.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}