DataList

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

Types

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

Properties

Link copied to clipboard
val size: Int

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

Functions

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:

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Checks for the existence of the given value in the DataList

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

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
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

Link copied to clipboard

Extracts a nested Boolean according to the given jsonPath.

Link copied to clipboard

Extracts a nested DataList according to the given jsonPath.

Link copied to clipboard

Extracts a nested DataObject according to the given jsonPath.

Link copied to clipboard

Extracts a nested Double according to the given jsonPath.

Link copied to clipboard

Extracts a nested Int according to the given jsonPath.

Link copied to clipboard

Extracts a nested Long according to the given jsonPath.

Link copied to clipboard

Extracts a nested String according to the given jsonPath.

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.

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.

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.

Link copied to clipboard

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

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.

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.

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.

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

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

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open operator override fun iterator(): Iterator<DataItem>
Link copied to clipboard

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

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