Target filter
Search Kotlin docs
  • Platforms
  • Tealium Prism Kotlin
core/com.tealium.prism.core.api.data/DataList

DataList

class DataList : Iterable<DataItem> , DataItemConvertible, JsonPathExtractable<JsonPath.Component.Index>

The DataList represents a list of restricted data types which are wrappable by DataItem, to ensure that all data passed to the SDK can be used correctly and without unexpected behaviours when converting to Strings.

Instances of DataList are immutable. When requiring updates, the copy method is available to use, which is prepopulate a Builder with the existing set of DataItems

Indexing starts at 0 as with standard Java lists.

This class will serialize to a JSON array - [ ... ] - when calling toString.

See also

DataItem
DataObject

Types

Builder
Link copied to clipboard
class Builder @JvmOverloads constructor(copy: DataList = EMPTY_LIST)
Companion
Link copied to clipboard
object Companion

Properties

size
Link copied to clipboard
val size: Int

Returns the number of top level entries stored in this list.

Functions

asDataItem
Link copied to clipboard
open override fun asDataItem(): DataItem

Should return an instance of a DataItem that represents all required properties of the implementing class, such that it could be:

asParcelable
Link copied to clipboard
fun DataList.asParcelable(): ParcelableDataItem

Returns a ParcelableDataItem that wraps the DataItem.

buildPath
Link copied to clipboard
fun buildPath(path: JsonListPath, item: DataItem): DataList

Takes a copy of this DataList and builds the necessary path according to the given path in order to store the given item.

buildUpon
Link copied to clipboard
fun buildUpon(): DataList.Builder

Convenience method to create a new Builder containing all the values in this DataList

contains
Link copied to clipboard
fun contains(value: DataItem): Boolean

Checks for the existence of the given value in the DataList

copy
Link copied to clipboard
inline fun copy(block: DataList.Builder.() -> Unit = {}): DataList

Copies the existing list into a new Builder instance that can be used to add/remove entries and create a new instance of the DataList

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
extract
Link copied to clipboard
open override fun extract(jsonPath: JsonPath<JsonPath.Component.Index>): DataItem?

Extracts a nested DataItem according to the given jsonPath.

open fun <T> extract(jsonPath: JsonPath<JsonPath.Component.Index>, 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.Index>): Boolean?

Extracts a nested Boolean according to the given jsonPath.

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

Extracts a nested DataList according to the given jsonPath.

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

Extracts a nested DataObject according to the given jsonPath.

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

Extracts a nested Double according to the given jsonPath.

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

Extracts a nested Int according to the given jsonPath.

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

Extracts a nested Long according to the given jsonPath.

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

Extracts a nested String according to the given jsonPath.

get
Link copied to clipboard
fun get(index: Int): DataItem?

Gets the DataItem at the given index.

fun <T> get(index: Int, converter: DataItemConverter<T>): T?

Gets the DataItem at the given index, and attempts to convert it into the type T using the provided DataItemConverter.

getBoolean
Link copied to clipboard
fun getBoolean(index: Int): Boolean?

Gets the Boolean entry at the given index if it exists and the value can be correctly coerced to an Boolean.

getDataList
Link copied to clipboard
fun getDataList(index: Int): DataList?

Gets the DataList entry at the given index if it exists and the value is a DataList.

getDataObject
Link copied to clipboard
fun getDataObject(index: Int): DataObject?

Gets the DataObject entry at the given index if it exists and the value is a DataObject.

getDouble
Link copied to clipboard
fun getDouble(index: Int): Double?

Gets the Double entry at the given index if it exists and the value is a Double, or a Number that can be coerced to an Double.

getInt
Link copied to clipboard
fun getInt(index: Int): Int?

Gets the Int entry at the given index if it exists and the value is an Int, or a Number that can be coerced to an Int.

getLong
Link copied to clipboard
fun getLong(index: Int): Long?

Gets the Long entry at the given index if it exists and the value is a Long, or a Number that can be coerced to an Long.

getString
Link copied to clipboard
fun getString(index: Int): String?

Gets the String entry at the given index if the underlying value is a String.

hashCode
Link copied to clipboard
open override fun hashCode(): Int
iterator
Link copied to clipboard
open operator override fun iterator(): Iterator<DataItem>
merge
Link copied to clipboard
fun <T> Iterable<Observable<T>>.merge(): Observable<T>

Convenience method for merging a Iterable group of Observables of the same type.

toString
Link copied to clipboard
open override fun toString(): String
Generated by Dokka
(c) Tealium 2026