PatchOp

sealed class PatchOp<T : Any>

JSON Merge Patch operations: none, set, delete

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Delete<T : Any> : PatchOp<T>

JSON Merge Patch delete operation that deletes the current value.

Link copied to clipboard
object Deserializer : JsonDeserializer<PatchOp<Any>> , ContextualDeserializer

Custom Deserializer for patch operations.

Link copied to clipboard
class None<T : Any> : PatchOp<T> , UpdateOp<T>

JSON Merge Patch none operation that leaves the current value untouched.

Link copied to clipboard
class Serializer : JsonSerializer<PatchOp<*>>

Custom Serializer for patch operations.

Link copied to clipboard
data class Set<T : Any>(val value: T) : PatchOp<T> , UpdateOp<T>

JSON Merge Patch set operation that sets/replaces the current value.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
inline fun <T : Any> PatchOp<T>.getOrDefaultNullifyingDelete(current: () -> T?): T?

Retrieves a value depending on the patch operation where delete is mapped to null and none is mapped to the value returned by given the current function.

Link copied to clipboard
inline fun <T : Any> PatchOp<T>.getOrElse(block: (deleted: Boolean) -> Nothing): T

Retrieves a value for set operations and calls the block function for delete and none operations.

Link copied to clipboard
inline fun <T : Any, R : Any> PatchOp<T>.map(transform: (T) -> R): PatchOp<R>

Transforms the value for set operations by calling the provided transform function and creating a new set operation; all other patch operations (delete and none) are returned as is.

Link copied to clipboard
inline fun <T : Any> PatchOp<T>.use(block: (T?) -> Unit)

Allows using a patch operation by passing an appropriate value to the given block function.