Optional

sealed class Optional<out V>

A sealed class that can either be Present or Absent

It provides a convenient way to distinguish the case when a value is provided explicitly and should be serialized (even if it's null) and the case where it's absent and shouldn't be serialized.

Types

Link copied to clipboard
object Absent : Optional<Nothing>
Link copied to clipboard
object Companion
Link copied to clipboard
data class Present<V>(val value: V) : Optional<V>

Functions

Link copied to clipboard
fun getOrNull(): V?
Link copied to clipboard
fun getOrThrow(): V

Inheritors

Link copied to clipboard
Link copied to clipboard