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

commonMain.aws.sdk.kotlin.hll.dynamodbmapper.util.Conditions.kt Maven / Gradle / Ivy

There is a newer version: 1.3.99-beta
Show newest version
/*
 * 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