Target filter
Search Kotlin docs
  • Back
  • Tealium Prism Kotlin SDK Reference
core/com.tealium.prism.core.api.data/DataObject/Builder

Builder

class Builder @JvmOverloads constructor(copy: DataObject = EMPTY_OBJECT) : DataItemExtractor

Constructors

Builder
Link copied to clipboard
@JvmOverloads
constructor(copy: DataObject = EMPTY_OBJECT)

Functions

build
Link copied to clipboard
fun build(): DataObject

Creates an immutable DataObject using the values added to the builder.

buildPath
Link copied to clipboard
fun buildPath(path: JsonObjectPath, item: DataItem): DataObject.Builder

Builds the necessary path according to the given path in order to store the given item.

clear
Link copied to clipboard
fun clear(): DataObject.Builder

Clears all entries in the Builder.

extract
Link copied to clipboard
open override fun extract(jsonPath: JsonPath<JsonPath.Component.Key>): DataItem?

Extracts a nested DataItem according to the given jsonPath.

open fun <T> extract(jsonPath: JsonPath<JsonPath.Component.Key>, converter: DataItemConverter<T>): T?

Extracts a nested DataItem according to the given jsonPath, and attempts to convert it to the type T using the given converter

extractBoolean
Link copied to clipboard
open fun extractBoolean(jsonPath: JsonPath<JsonPath.Component.Key>): Boolean?

Extracts a nested Boolean according to the given jsonPath.

extractDataList
Link copied to clipboard
open fun extractDataList(jsonPath: JsonPath<JsonPath.Component.Key>): DataList?

Extracts a nested DataList according to the given jsonPath.

extractDataObject
Link copied to clipboard
open fun extractDataObject(jsonPath: JsonPath<JsonPath.Component.Key>): DataObject?

Extracts a nested DataObject according to the given jsonPath.

extractDouble
Link copied to clipboard
open fun extractDouble(jsonPath: JsonPath<JsonPath.Component.Key>): Double?

Extracts a nested Double according to the given jsonPath.

extractInt
Link copied to clipboard
open fun extractInt(jsonPath: JsonPath<JsonPath.Component.Key>): Int?

Extracts a nested Int according to the given jsonPath.

extractLong
Link copied to clipboard
open fun extractLong(jsonPath: JsonPath<JsonPath.Component.Key>): Long?

Extracts a nested Long according to the given jsonPath.

extractString
Link copied to clipboard
open fun extractString(jsonPath: JsonPath<JsonPath.Component.Key>): String?

Extracts a nested String according to the given jsonPath.

get
Link copied to clipboard
open fun <T> get(key: String, converter: DataItemConverter<T>): T?

Gets the DataItem stored at the given key if there is one, and uses the given converter to translate it into an instance of type T

open operator override fun get(key: String): DataItem?

Gets the DataItem at the given key, if there is one.

getBoolean
Link copied to clipboard
open fun getBoolean(key: String): Boolean?

Gets the Boolean stored at the given key if there is one

getDataList
Link copied to clipboard
open fun getDataList(key: String): DataList?

Gets the DataList stored at the given key if there is one

getDataObject
Link copied to clipboard
open fun getDataObject(key: String): DataObject?

Gets the DataObject stored at the given key if there is one

getDouble
Link copied to clipboard
open fun getDouble(key: String): Double?

Gets the Double stored at the given key if there is one

getInt
Link copied to clipboard
open fun getInt(key: String): Int?

Gets the Int stored at the given key if there is one

getLong
Link copied to clipboard
open fun getLong(key: String): Long?

Gets the Long stored at the given key if there is one

getString
Link copied to clipboard
open fun getString(key: String): String?

Gets the String stored at the given key if there is one

put
Link copied to clipboard
fun put(key: String, value: DataItem): DataObject.Builder
fun put(key: String, value: Boolean): DataObject.Builder
fun put(key: String, value: Double): DataObject.Builder
fun put(key: String, value: Int): DataObject.Builder
fun put(key: String, value: Long): DataObject.Builder
fun put(key: String, value: String): DataObject.Builder

Adds the provided value into this DataObject.Builder, overwriting the existing item at that key if it already exists.

fun put(key: String, value: DataItemConvertible): DataObject.Builder

Adds a DataItemConvertible object to the DataObject. The

putAll
Link copied to clipboard
fun putAll(dataObject: DataObject): DataObject.Builder

Adds all entries from the provided dataObject into this DataObject.Builder, overwriting any keys that already exist.

putAny
Link copied to clipboard
fun putAny(key: String, any: Any?): DataObject.Builder

Unsafe shortcut to put any object into the DataObject. The any will attempt to be converted to a supported type. If no supported type is available, then an UnsupportedDataItemException will be thrown.

putAnyOrNull
Link copied to clipboard
fun putAnyOrNull(key: String, any: Any?): DataObject.Builder

Attempts to put any object into the DataObject. The any will attempt to be converted to a supported type. If no supported type is available, then DataItem.NULL will be instead.

putNull
Link copied to clipboard
fun putNull(key: String): DataObject.Builder

Adds a DataItem.NULL object to the DataObject.

remove
Link copied to clipboard
fun remove(key: String): DataObject.Builder

Removes the entry currently stored at the current key. If the key does not exist, then this is a no-operation.

Generated by Dokka
(c) Tealium 2026