commonMain.aws.sdk.kotlin.hll.dynamodbmapper.pipeline.internal.HResContextImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dynamodb-mapper-jvm Show documentation
Show all versions of dynamodb-mapper-jvm Show documentation
High level DynamoDbMapper client
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.sdk.kotlin.hll.dynamodbmapper.pipeline.internal
import aws.sdk.kotlin.hll.dynamodbmapper.items.ItemSchema
import aws.sdk.kotlin.hll.dynamodbmapper.pipeline.HResContext
import aws.sdk.kotlin.hll.dynamodbmapper.pipeline.MapperContext
import aws.sdk.kotlin.hll.dynamodbmapper.util.requireNull
internal data class HResContextImpl(
override val highLevelRequest: HReq,
override val serializeSchema: ItemSchema,
override val mapperContext: MapperContext,
override val lowLevelRequest: LReq,
override val lowLevelResponse: LRes,
override val deserializeSchema: ItemSchema,
override val highLevelResponse: HRes,
override val error: Throwable?,
) : HResContext,
ErrorCombinable>,
Combinable, HRes> {
override fun plus(e: Throwable?) = copy(error = e.suppressing(error))
override fun plus(value: HRes) = copy(highLevelResponse = value)
}
internal fun HResContextImpl.solidify() =
HResContextImpl(
highLevelRequest,
serializeSchema,
mapperContext,
lowLevelRequest,
lowLevelResponse,
deserializeSchema,
requireNotNull(highLevelResponse) { "Cannot solidify context with a null high-level response" } as HRes,
requireNull(error) { "Cannot solidify context with a non-null error" },
)