Delegates

Standard property delegates.

Since Kotlin

1.1

Standard property delegates.

Since Kotlin

1.0

Functions

Link copied to clipboard

Returns a property delegate for a read/write property with a non-null value that is initialized not during object construction time but at a later time. Trying to read the property before the initial value has been assigned results in an exception.

Since Kotlin 1.1

Returns a property delegate for a read/write property with a non-null value that is initialized not during object construction time but at a later time. Trying to read the property before the initial value has been assigned results in an exception.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> observable(initialValue: T, crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Unit): ReadWriteProperty<Any?, T>

Returns a property delegate for a read/write property that calls a specified callback function when changed.

Since Kotlin 1.1
inline fun <T> observable(initialValue: T, crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Unit): ReadWriteProperty<Any?, T>

Returns a property delegate for a read/write property that calls a specified callback function when changed.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> vetoable(initialValue: T, crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Boolean): ReadWriteProperty<Any?, T>

Returns a property delegate for a read/write property that calls a specified callback function when changed, allowing the callback to veto the modification.

Since Kotlin 1.1
inline fun <T> vetoable(initialValue: T, crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Boolean): ReadWriteProperty<Any?, T>

Returns a property delegate for a read/write property that calls a specified callback function when changed, allowing the callback to veto the modification.

Since Kotlin 1.0