commonMain.aws.sdk.kotlin.hll.dynamodbmapper.util.Conditions.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.util
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
@OptIn(ExperimentalContracts::class)
internal fun requireNull(value: T?, lazyMessage: () -> Any): T? {
contract {
returns() implies (value == null)
}
if (value == null) {
return null
} else {
val message = lazyMessage()
throw IllegalArgumentException(message.toString())
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy