KpaPrimitive

Represents a leaf value (string, number, boolean, or null) in an adapter-neutral way.

Typed accessors (isString, isBoolean, isNumber, isNull, stringOrNull, booleanOrNull, doubleOrNull, longOrNull) allow callers to inspect and unwrap the value without depending on a concrete adapter type. Use renderedString to obtain a human-readable representation.

Inheritors

Properties

Link copied to clipboard
abstract val booleanOrNull: Boolean?

The boolean value if isBoolean; null otherwise.

Link copied to clipboard
abstract val doubleOrNull: Double?

The numeric value as Double if isNumber; null otherwise.

Link copied to clipboard
abstract val isBoolean: Boolean

true if this primitive holds a JSON boolean value.

Link copied to clipboard
abstract val isNull: Boolean

true if this primitive represents JSON null.

Link copied to clipboard
abstract val isNumber: Boolean

true if this primitive holds a JSON number value (integer or floating-point, but not boolean).

Link copied to clipboard
abstract val isString: Boolean

true if this primitive holds a JSON string value.

Link copied to clipboard
abstract val longOrNull: Long?

The numeric value as Long if isNumber and the value is representable as a Long without data loss; null otherwise.

Link copied to clipboard
abstract val stringOrNull: String?

The string content if isString; null otherwise.

Functions

Link copied to clipboard
abstract fun renderedString(): String

Returns a human-readable string form of this primitive's value.

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.