KpaList

Read-only view of a list-shaped structure addressable by integer indices.

Read-only adapters implement this interface directly. Adapter families that support mutation implement RebuildableKpaList, which adds the KpaElementFactory needed to rebuild after a change.

Inheritors

Properties

Link copied to clipboard
abstract val size: Int

The number of elements in this list.

Functions

Link copied to clipboard

Returns the boolean value at pointer, or null if the path is absent or the value is not a boolean primitive.

Parses path via KPointer.from and returns the boolean value at that path, or null if absent or not a boolean.

Link copied to clipboard

Returns the numeric value as Double at pointer, or null if the path is absent or the value is not a numeric primitive.

Parses path via KPointer.from and returns the numeric value as Double at that path, or null if absent or not numeric.

Link copied to clipboard
abstract operator fun get(index: Int): KpaElement

Returns the element at index. Throws on out-of-range indices.

Link copied to clipboard
operator fun KpaList.get(pointer: KPointer): KpaElement?

Returns the KpaElement at the path identified by pointer, or null if the index is out of range — an absent element, consistent with KpaStruct.get returning null for an absent key.

Link copied to clipboard
fun KpaList.listAt(pointer: KPointer): KpaList?

Returns the KpaList at pointer, or null if the path is absent or the value is not a list.

Parses path via KPointer.from and returns the KpaList at that path, or null if absent or not a list.

Link copied to clipboard
fun KpaList.longAt(pointer: KPointer): Long?

Returns the numeric value as Long at pointer, or null if the path is absent, the value is not a numeric primitive, or the value has a fractional component.

fun KpaList.longAt(path: String): Long?

Parses path via KPointer.from and returns the numeric value as Long at that path, or null if absent, not numeric, or has a fractional component.

Link copied to clipboard

Returns the KpaPrimitive at pointer, or null if the path is absent or the value is not a primitive.

Parses path via KPointer.from and returns the KpaPrimitive at that path, or null if absent or not a primitive.

Link copied to clipboard
inline fun <B : Any> KpaElement.requireBacking(libraryName: String): B

Unwraps this KpaElement to its native backing value of type B, or throws if this element is not a BackedKpaElement whose backing is of type B.

Link copied to clipboard

Returns the string value at pointer, or null if the path is absent or the value is not a string primitive.

Parses path via KPointer.from and returns the string value at that path, or null if absent or not a string.

Link copied to clipboard

Returns the KpaStruct at pointer, or null if the path is absent or the value is not a struct.

Parses path via KPointer.from and returns the KpaStruct at that path, or null if absent or not a struct.

Link copied to clipboard
abstract fun toList(): List<KpaElement>

Returns a snapshot of this list as a plain List.