KpaStructMutationScope

DSL scope for applying pointer-based mutations to a KpaStruct.

Instances are created internally by KpaStruct.mutate. Use the to infix functions to specify mutations, and remove to delete entries.

Delegates to KpaElementFactory from the original struct so that toPrimitive extensions are available directly inside the lambda.

Properties

Link copied to clipboard
open override val nullPrimitive: KpaPrimitive

A pre-built KpaPrimitive representing JSON null.

Functions

Link copied to clipboard
fun remove(pointer: KPointer)

Removes the element at pointer.

fun remove(path: String)

Removes the element at path.

Link copied to clipboard
infix fun KPointer.to(value: KpaElement)
infix fun KPointer.to(value: Boolean)
infix fun KPointer.to(value: Double)
infix fun KPointer.to(value: Float)
infix fun KPointer.to(value: Int)
infix fun KPointer.to(value: Long)
infix fun KPointer.to(value: String)

Sets the value at this pointer to value.

infix fun KPointer.to(value: Nothing?)

Sets the value at this pointer to null.

infix fun String.to(value: KpaElement)
infix fun String.to(value: Boolean)
infix fun String.to(value: Double)
infix fun String.to(value: Float)
infix fun String.to(value: Int)
infix fun String.to(value: Long)
infix fun String.to(value: String)

Sets the value at the pointer path this to value.

infix fun String.to(value: Nothing?)

Sets the value at the pointer path this to null.

Link copied to clipboard
open override fun Boolean.toPrimitive(): KpaPrimitive
open override fun Double.toPrimitive(): KpaPrimitive
open override fun Float.toPrimitive(): KpaPrimitive
open override fun Int.toPrimitive(): KpaPrimitive
open override fun Long.toPrimitive(): KpaPrimitive
open override fun String.toPrimitive(): KpaPrimitive
Link copied to clipboard
open override fun withList(list: List<KpaElement>): RebuildableKpaList

Builds a new RebuildableKpaList of the factory's adapter family wrapping list.

Link copied to clipboard
open override fun withMap(map: Map<String, KpaElement>): RebuildableKpaStruct

Builds a new RebuildableKpaStruct of the factory's adapter family wrapping map.