getValue

Common
JVM
JS
Native
1.4
operator fun <V> KProperty0<V>.getValue(
    thisRef: Any?,
    property: KProperty<*>
): V

(source)

An extension operator that allows delegating a read-only property of type V to a property reference to a property of type V or its subtype.

Receiver

A property reference to a read-only or mutable property of type V or its subtype. The reference is without a receiver, i.e. it either references a top-level property or has the receiver bound to it.

Example:

class Login(val username: String)
val defaultLogin = Login("Admin")
val defaultUsername by defaultLogin::username
// equivalent to
val defaultUserName get() = defaultLogin.username

Common
JVM
JS
Native
1.4
operator fun <T, V> KProperty1<T, V>.getValue(
    thisRef: T,
    property: KProperty<*>
): V

(source)

An extension operator that allows delegating a read-only member or extension property of type V to a property reference to a member or extension property of type V or its subtype.

Receiver

A property reference to a read-only or mutable property of type V or its subtype. The reference has an unbound receiver of type T.

Example:

class Login(val username: String)
val Login.user by Login::username
// equivalent to
val Login.user get() = this.username

Common
JVM
JS
Native
1.0
operator fun <T> Lazy<T>.getValue(
    thisRef: Any?,
    property: KProperty<*>
): T

(source)

An extension to delegate a read-only property of type T to an instance of Lazy.

This extension allows to use instances of Lazy for property delegation: val property: String by lazy { initializer }