LockableValueDsl

abstract class LockableValueDsl : ValueDsl(source)

Extension of ValueDsl that adds locking functionality to prevent further modifications.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Indicates whether the DSL is locked.

Functions

Link copied to clipboard
protected open fun <I, O> conditional(defaultValue: I, beforeGet: KProperty<*>.(I) -> Boolean = { true }, beforeSet: KProperty<*>.(O) -> Boolean = { true }, getTransform: KProperty<*>.(I) -> O, setTransform: KProperty<*>.(O) -> I, validateGet: KProperty<*>.(O) -> Boolean = { true }, validateSet: KProperty<*>.(I) -> Boolean = { true }, messageBuilder: KProperty<*>.() -> Any = { "Invalid value for property $name." }): ReadWriteProperty<Any?, O>

Creates a property delegate with validation and transformation logic.

Link copied to clipboard
protected open fun <T> list(initial: MutableList<T> = mutableListOf(), getTransform: (T) -> T = { it }, setTransform: (T) -> T = { it }, beforeAccess: (MutableList<T>) -> Unit = {}): DslReadOnlyListProperty<T>

Creates a non-replaceable mutable list property delegate with element transformations and a hook.

Link copied to clipboard
protected fun lock()

Locks the DSL, preventing further modifications.

Link copied to clipboard
protected open fun <T> optional(getTransform: KProperty<*>.(T?) -> T? = { it }, setTransform: KProperty<*>.(T?) -> T? = { it }): ReadWriteProperty<Any?, T?>

Creates an optional property delegate (nullable).

Link copied to clipboard
protected open fun <T> prepared(defaultValue: T, getTransform: KProperty<*>.(T) -> T = { it }, setTransform: KProperty<*>.(T) -> T = { it }): ReadWriteProperty<Any?, T>

Creates a property delegate with a default value and optional transformations.

Link copied to clipboard
protected open fun <T> replaceableList(initial: MutableList<T> = mutableListOf(), getTransform: (T) -> T = { it }, setTransform: (T) -> T = { it }, beforeAccess: (MutableList<T>) -> Unit = {}, beforeReplace: (MutableList<T>) -> Unit = {}): DslReadWriteListProperty<T>

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

Link copied to clipboard
protected open fun <T> required(getTransform: KProperty<*>.(T) -> T = { it }, setTransform: KProperty<*>.(T) -> T = { it }, messageBuilder: KProperty<*>.() -> Any = { "Property is required and cannot be null." }): ReadWriteProperty<Any?, T>

Creates a required (non-null) property delegate.

Link copied to clipboard
protected open override fun <I, O> value(defaultValue: I, getTransform: KProperty<*>.(I) -> O, setTransform: KProperty<*>.(O) -> I): ReadWriteProperty<Any?, O>

Creates a property delegate with custom get/set transformations.

protected open override fun <I, O> value(initial: MutableList<I>, getTransform: MutableList<O>.(I) -> O, setTransform: MutableList<O>.(O) -> I, beforeAccess: (MutableList<O>) -> Unit): DslReadOnlyListProperty<O>

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

protected open override fun <I, O> value(initial: MutableList<I>, getTransform: MutableList<O>.(I) -> O, setTransform: MutableList<O>.(O) -> I, beforeAccess: (MutableList<O>) -> Unit, beforeReplace: (MutableList<O>) -> Unit): DslReadWriteListProperty<O>

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