commonMain.com.pubnub.api.utils.PatchValue.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-kotlin-api-jvm Show documentation
Show all versions of pubnub-kotlin-api-jvm Show documentation
PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!
The newest version!
package com.pubnub.api.utils
import kotlin.jvm.JvmStatic
/**
* An optional that accepts nullable values. Thus, it can represent two (`PatchValue`) or three (`PatchValue?`) states:
* * `PatchValue.of(someValue)` - value is present and that value is `someValue`
* * `PatchValue.of(null)` - value is present and that value is `null`
* * `null` - lack of information about value (no update for this field)
*/
data class PatchValue internal constructor(val value: T) {
companion object {
/**
* Create an optional with the specified value (which can be null).
*/
@JvmStatic
fun of(value: T): PatchValue = PatchValue(value)
}
}