W3cubDocs

/Kotlin

ObservableProperty

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
abstract class ObservableProperty<V> : 
    ReadWriteProperty<Any?, V>

Implements the core logic of a property delegate for a read/write property that calls callback functions when changed.

Parameters

initialValue - the initial value of the property.

Constructors

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

<init>

Implements the core logic of a property delegate for a read/write property that calls callback functions when changed.

ObservableProperty(initialValue: V)

Functions

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

afterChange

The callback which is called after the change of the property is made. The value of the property has already been changed when this callback is invoked.

open fun afterChange(
    property: KProperty<*>, 
    oldValue: V, 
    newValue: V)
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

beforeChange

The callback which is called before a change to the property value is attempted. The value of the property hasn't been changed yet, when this callback is invoked. If the callback returns true the value of the property is being set to the new value, and if the callback returns false the new value is discarded and the property remains its old value.

open fun beforeChange(
    property: KProperty<*>, 
    oldValue: V, 
    newValue: V
): Boolean
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

getValue

Returns the value of the property for the given object.

open fun getValue(thisRef: Any?, property: KProperty<*>): V
Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

setValue

Sets the value of the property for the given object.

open fun setValue(
    thisRef: Any?, 
    property: KProperty<*>, 
    value: V)

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.properties/-observable-property/index.html