getOrElse

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.

  • set - If the patch is a set, the new value will be returned.

  • delete - If the patch is a delete, block is called with the deleted parameter set to true.

  • none - If the patch is none, block is called with the deleted parameter set to false.

The provided block is function that returns Nothing and therefore must throw an exception or some other equivalent operation.

Return

Value depending on the patch operation.

Parameters

block

Function to be called for delete or none operations.