KpaElementFactory

Factory of KpaElement values for a particular backing representation.

Consolidates "wrap a typed value into a KpaPrimitive" and "rebuild a KpaStruct / KpaList from a snapshot" responsibilities for an adapter family. Each adapter family is expected to expose a single factory instance (typically an object) that KpaStruct.factory and KpaList.factory both reference.

The primitive helpers are member extension functions: they are only callable when a KpaElementFactory is the dispatch receiver. The mutation DSL achieves that via interface delegation (: KpaElementFactory by original.factory); outside the DSL, use with(factory) { ... }.

Inheritors

Properties

Link copied to clipboard

A pre-built KpaPrimitive representing JSON null.

Functions

Link copied to clipboard
Link copied to clipboard
abstract fun withList(list: List<KpaElement>): KpaList

Builds a new KpaList of the factory's adapter family wrapping list.

Link copied to clipboard
abstract fun withMap(map: Map<String, KpaElement>): KpaStruct

Builds a new KpaStruct of the factory's adapter family wrapping map.