org.pkl.thirdparty.kotlin.collections.MapAccessors.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pkl-tools Show documentation
Show all versions of pkl-tools Show documentation
Fat Jar containing pkl-cli, pkl-codegen-java, pkl-codegen-kotlin, pkl-config-java, pkl-core, pkl-doc, and their shaded third-party dependencies.
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:org.pkl.thirdparty.kotlin.jvm.JvmName("MapAccessorsKt")
package org.pkl.thirdparty.kotlin.collections
import org.pkl.thirdparty.kotlin.reflect.KProperty
import org.pkl.thirdparty.kotlin.internal.Exact
/**
* Returns the value of the property for the given object from this read-only map.
* @param thisRef the object for which the value is requested (not used).
* @param property the metadata for the property, used to get the name of property and lookup the value corresponding to this name in the map.
* @return the property value.
*
* @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
*/
@org.pkl.thirdparty.kotlin.internal.InlineOnly
public inline operator fun Map.getValue(thisRef: Any?, property: KProperty<*>): V1 =
@Suppress("UNCHECKED_CAST") (getOrImplicitDefault(property.name) as V1)
/**
* Returns the value of the property for the given object from this mutable map.
* @param thisRef the object for which the value is requested (not used).
* @param property the metadata for the property, used to get the name of property and lookup the value corresponding to this name in the map.
* @return the property value.
*
* @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
*/
@org.pkl.thirdparty.kotlin.jvm.JvmName("getVar")
@org.pkl.thirdparty.kotlin.internal.InlineOnly
public inline operator fun MutableMap.getValue(thisRef: Any?, property: KProperty<*>): V1 =
@Suppress("UNCHECKED_CAST") (getOrImplicitDefault(property.name) as V1)
/**
* Stores the value of the property for the given object in this mutable map.
* @param thisRef the object for which the value is requested (not used).
* @param property the metadata for the property, used to get the name of property and store the value associated with that name in the map.
* @param value the value to set.
*/
@org.pkl.thirdparty.kotlin.internal.InlineOnly
public inline operator fun MutableMap.setValue(thisRef: Any?, property: KProperty<*>, value: V) {
this.put(property.name, value)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy