Package-level declarations

Data definition

Types

Link copied to clipboard

Immutable data class for restricting the supported types that can be passed into the system.

Link copied to clipboard
fun interface DataItemConverter<T>

Classes that implement this interface should be able to reconstruct an object of type T from a given DataItem - on the assumption that the DataItem does accurately describe all components required to create a new instance of type T

Link copied to clipboard
fun interface DataItemConvertible

Classes that implement this interface should be able to convert themselves successfully to an instance of DataItem. Typically this can be achieved by using DataItem.convert.

Link copied to clipboard

Defines common read methods for getting or extracting common data types from a Map-like object containing DataItems

Link copied to clipboard

A set of utility methods for conversions of common data types into their DataItem equivalent.

Link copied to clipboard

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.

Link copied to clipboard

The DataObject represents a map 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.

Link copied to clipboard

Classes that implement this interface should be able to convert themselves successfully to an instance of DataObject.

Link copied to clipboard
fun interface Deserializer<T, R>

Transforms an input object of type T to an output object of type R

Link copied to clipboard

A JsonPath that can be applied to a JSON array to represent the path to a potentially nested value. Nested items can be in both JSON objects and JSON arrays.

Link copied to clipboard

A JsonPath that can be applied to a JSON object to represent the path to a potentially nested value. Nested items can be in both JSON objects and JSON arrays.

Link copied to clipboard

A structure representing the location of an item in a JSON object or JSON array, potentially nested in other JSON objects and JSON arrays.

Link copied to clipboard

Interface defining common methods for extracting DataItems using a JsonPath object.

Link copied to clipboard
abstract class JsonPathParseException(message: String, cause: Throwable? = null) : TealiumException

Base exception for all Exceptions thrown when parsing a JsonPath.

Link copied to clipboard
class JsonPathSyntaxException(val position: Int, message: String, cause: Throwable? = null) : JsonPathParseException

Exception to indicate that there a syntax error in the provided JsonPath string which could not be parsed successfully.

Link copied to clipboard

A collection of lenient converters that can handle type mismatches in JSON data.

Link copied to clipboard
class ParcelableDataItem(val dataItem: DataItem) : Parcelable

Parcelable wrapper class for DataItem to allow easy interop with Android Bundles

Link copied to clipboard

A container for a reference to a variable in a DataObject

Link copied to clipboard

A container for holding a specific String.

Link copied to clipboard

Indicates that the parser reached the end of the JsonPath string input, but was expecting additional tokens.

Link copied to clipboard
class UnsupportedDataItemException(message: String? = null, cause: Throwable? = null) : TealiumException

This Exception is thrown in cases where a conversion from an value to a DataItem has been attempted but has failed to do so.

Link copied to clipboard

A container for holding a specific DataItem.

Functions

Link copied to clipboard

Utility method to cast a JsonPath of unknown type, e.g. from a JsonPath.parse to the required type.

Link copied to clipboard

Utility method to cast a JsonPath of unknown type, e.g. from a JsonPath.parse to the required type.

Link copied to clipboard
fun JSONArray.forEach(block: (value: Any) -> Unit)

Utility function to allow forEach iteration on a JSONArray

Link copied to clipboard
fun JSONArray.forEachIndexed(block: (value: Any, index: Int) -> Unit)

Utility function to allow forEach with index iteration on a JSONArray

Link copied to clipboard

Kotlin convenience method to allow expressing JsonPath items in a more succinct way:

Link copied to clipboard

Utility method to retrieve a DataItem from a Bundle. This method assumes that the object was originally placed into the Bundle as a ParcelableDataItem

Link copied to clipboard

Utility method to retrieve a DataItemConvertible from a Bundle. This method assumes that the object was originally placed into the Bundle as a ParcelableDataItem

Link copied to clipboard

Utility method to retrieve a DataList from a Bundle. This method assumes that the object was originally placed into the Bundle as a ParcelableDataItem

Link copied to clipboard

Utility method to retrieve a DataObject from a Bundle. This method assumes that the object was originally placed into the Bundle as a ParcelableDataItem

Link copied to clipboard
fun <T> JSONArray.map(transform: (value: Any) -> T): List<T>

Utility function to allow map iterating on a JSONArray

Link copied to clipboard
inline fun <T> DataObject.mapValues(transform: (DataItem) -> T): Map<String, T>

Maps the Map.Entry.value component only, keeping the Map.Entry.key the same.

fun <T> JSONObject.mapValues(block: (value: Any) -> T): Map<String, T>

Utility function to allow transforming a JSONObject's values.

Link copied to clipboard
inline fun <T> DataObject.mapValuesNotNull(transform: (DataItem) -> T?): Map<String, T>

Maps the Map.Entry.value component only, keeping the Map.Entry.key the same.

Link copied to clipboard
operator fun DataObject.plus(other: DataObject): DataObject

Merges two DataObject objects together.

Link copied to clipboard
fun Bundle.putDataItem(key: String, dataItem: DataItem)

Utility method to place a DataItem directly into a Bundle. This method will serialize as a ParcelableDataItem to store in the Bundle

Link copied to clipboard

Utility method to place a DataItemConvertible directly into a Bundle. This method will serialize as a ParcelableDataItem to store in the Bundle

Link copied to clipboard
fun Bundle.putDataList(key: String, dataList: DataList)

Utility method to place a DataList directly into a Bundle. This method will serialize as a ParcelableDataItem to store in the Bundle

Link copied to clipboard
fun Bundle.putDataObject(key: String, dataObject: DataObject)

Utility method to place a DataObject directly into a Bundle. This method will serialize as a ParcelableDataItem to store in the Bundle

Link copied to clipboard

Utility method to cast a JsonPath of unknown type, e.g. from a JsonPath.parse to the required type.

Link copied to clipboard

Utility method to cast a JsonPath of unknown type, e.g. from a JsonPath.parse to the required type.