ObservableProperty

interface ObservableProperty<T>

A synchronous property delegate accessor.

NOTE: DeferredObservableProperty is the asynchronous variation lacking initial value.

Types

Companion
Link copied to clipboard
object Companion
EqualityPolicy
Link copied to clipboard
fun fun interface EqualityPolicy<T>
This interface is used to provide custom equality for various ObservableProperty operators like ObservableProperty.map and ObservableProperty.filter.
Listener
Link copied to clipboard
interface Listener<T> : ValueChangeListener<T, T>
Implemented by listeners to ObservableProperty value changes.

Functions

addListener
Link copied to clipboard
abstract fun addListener(listener: ObservableProperty.Listener<T>): CancellationToken
Add a ValueChangeListener for value change on this property.
removeListener
Link copied to clipboard
abstract fun removeListener(listener: ObservableProperty.Listener<T>)
Remove a ValueChangeListener from listeners to value change on this property.

Properties

value
Link copied to clipboard
abstract val value: T
Currently assigned value.

Inheritors

MutableObservableProperty
Link copied to clipboard

Extensions

asChannel
Link copied to clipboard
fun <T> ObservableProperty<T>.asChannel(): Channel<T>
Conversion method to Channel.
asFlow
Link copied to clipboard
fun <T> ObservableProperty<T>.asFlow(): Flow<T>
Conversion method to Flow.
deferred
Link copied to clipboard
fun <T> ObservableProperty<T>.deferred(): DeferredObservableProperty<T>
Conversion method to asynchronous DeferredObservableProperty.
filter
Link copied to clipboard
fun <T> ObservableProperty<T>.filter(equalityPolicy: ObservableProperty.EqualityPolicy<T> = defaultEqualityPolicy(), predicate: (T) -> Boolean): DeferredObservableProperty<T>
A filter function applied to each element collected from the ObservableProperty.
fun <T> ObservableProperty<T>.filter(initialValue: T, equalityPolicy: ObservableProperty.EqualityPolicy<T> = defaultEqualityPolicy(), predicate: (T) -> Boolean): ObservableProperty<T>
A filter function applied to each element collected from the ObservableProperty.
filterNotNull
Link copied to clipboard
fun <T : Any> ObservableProperty<T?>.filterNotNull(equalityPolicy: ObservableProperty.EqualityPolicy<T> = defaultEqualityPolicy()): DeferredObservableProperty<T>
Keep each non-null element collected from the ObservableProperty.
flatMapLatest
Link copied to clipboard
fun <T, U> ObservableProperty<T>.flatMapLatest(equalityPolicy: ObservableProperty.EqualityPolicy<ObservableProperty<U>> = identityEqualityPolicy(), transform: (T) -> ObservableProperty<U>): ObservableProperty<U>
A mapping function applied to each element collected from the ObservableProperty to return another ObservableProperty.
map
Link copied to clipboard
fun <T, U> ObservableProperty<T>.map(equalityPolicy: ObservableProperty.EqualityPolicy<U> = defaultEqualityPolicy(), transform: (T) -> U): ObservableProperty<U>
A mapping function applied to each element collected from the ObservableProperty.
nextValue
Link copied to clipboard
suspend fun <T> ObservableProperty<T>.nextValue(): T
Block current thread in wait for the next value change.