value

protected open fun <I, O> value(defaultValue: I, getTransform: KProperty<*>.(I) -> O, setTransform: KProperty<*>.(O) -> I): ReadWriteProperty<Any?, O>(source)

Creates a property delegate with custom get/set transformations.

Parameters

defaultValue

The initial value.

getTransform

Transformation applied on get.

setTransform

Transformation applied on set.


protected open fun <I, O> value(initial: MutableList<I> = mutableListOf(), getTransform: MutableList<O>.(I) -> O, setTransform: MutableList<O>.(O) -> I, beforeAccess: (MutableList<O>) -> Unit = {}): DslReadOnlyListProperty<O>(source)

Creates a mutable list property delegate with transformations and a hook.

Parameters

initial

Initial list.

getTransform

Transformation for getting elements.

setTransform

Transformation for setting elements.

beforeAccess

Hook before accessing the list.


protected open fun <I, O> value(initial: MutableList<I> = mutableListOf(), getTransform: MutableList<O>.(I) -> O, setTransform: MutableList<O>.(O) -> I, beforeAccess: (MutableList<O>) -> Unit = {}, beforeReplace: (MutableList<O>) -> Unit = {}): DslReadWriteListProperty<O>(source)

Creates a replaceable mutable list property delegate with transformations and hooks.

Parameters

initial

Initial list.

getTransform

Transformation for getting elements.

setTransform

Transformation for setting elements.

beforeAccess

Hook before accessing the list.

beforeReplace

Hook before replacing the list.