GenericElementWrapper

class GenericElementWrapper<T : Any>(val element: T, val elementSerializer: KSerializer<T>) : GenericElement(source)

A GenericElement implementation that wraps a value of type T.

Report a problem

Constructors

Link copied to clipboard
constructor(element: T, elementSerializer: KSerializer<T>)

Properties

Link copied to clipboard
open override val element: T

The underlying element.

Link copied to clipboard
open override val elementSerializer: KSerializer<T>

The serializer used to deserialize the element.

Functions

Link copied to clipboard
inline fun <T> GenericElement.asA(): T

Deserialize an element to the given type T.

Link copied to clipboard
open override fun <T> deserialize(serializer: DeserializationStrategy<T>): T

Deserializes the element into the given serializer.

Link copied to clipboard
open override fun entries(): List<Pair<String, GenericElement>>

If this is a map, return a list of key-value entries.

Link copied to clipboard
open fun isArray(): Boolean

Returns true if the element is a JSON array.

Link copied to clipboard
open fun isObject(): Boolean

Returns true if the element is a JSON object.

Link copied to clipboard
open fun isString(): Boolean

Returns true if the element is a JSON primitive and is a string.

Link copied to clipboard
open override fun items(): List<GenericElement>

If this is a list, return all elements.

Link copied to clipboard

Returns the empty element if the given element is null, otherwise returns the element.

Link copied to clipboard
open operator fun plus(other: GenericElement): GenericElement

Merges two elements into a single element with the keys of both.

Link copied to clipboard
open override fun toString(): String