CaseKeyPath

A conditional, typed read through one case of a sealed hierarchy.

A CaseKeyPath is also its lossy Kotlin function view, from Root to Value?. It can therefore be passed directly to APIs such as mapNotNull. Use match rather than invocation when a matched null must remain distinguishable from a nonmatching root.

Inheritors

Properties

Link copied to clipboard
abstract val __kpaths_id: PathId

Library-reserved structural identity metadata.

Link copied to clipboard

Library-reserved focused-value type metadata.

Functions

Link copied to clipboard

Appends two CaseKeyPaths, retaining independent embedding through both cases.

Link copied to clipboard

Returns this path's structural suffix after after, or null when after is not its ancestor.

Link copied to clipboard
abstract fun embed(value: Value): Root

Embeds value in a newly constructed root, independent of any existing root value.

Link copied to clipboard
open fun extract(root: Root): Value?

A lossy convenience projection; use match when a matched null must remain distinguishable.

Link copied to clipboard
open fun extractAny(root: Root): Any?

Legacy, intentionally lossy extraction for type-erased consumers.

Link copied to clipboard
open operator override fun invoke(root: Root): Value?

Invokes this CaseKeyPath as its lossy extraction function.

Link copied to clipboard

Returns whether this path identifies a descendant (or the same location as) ancestor.

Link copied to clipboard

Returns whether this path identifies an ancestor (or the same location as) other.

Link copied to clipboard
abstract fun match(root: Root): CaseMatch<Value>

Returns the exact result of attempting to match root.

Link copied to clipboard
open override fun matchAny(root: Root): CaseMatch<Any?>

Matches while retaining the distinction between an unmatched root and a matched null.

Link copied to clipboard
open fun matches(root: Root): Boolean

Returns true whenever the represented case matched, including for a matched null payload.

Link copied to clipboard

Views a non-null CaseKeyPath as a total, read-only KeyPath whose focus is nullable.

Link copied to clipboard

Kotlin-friendly spelling of CaseKeyPath.