JsonMap

An immutable mapping of String keys to JsonValues.

Constructors

Link copied to clipboard
constructor(map: Map<String, JsonValue>?)

Types

Link copied to clipboard
class Builder

Builder class for com.urbanairship.json.JsonMap Objects.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Gets the JsonMap as a Map.

Functions

Link copied to clipboard

Returns whether this map contains the specified key.

Link copied to clipboard

Returns whether this map contains the specified value.

Link copied to clipboard

Returns a set containing all of the mappings in this map. Each mapping is an instance of Map.Entry. As the set is backed by this map, changes in one will be reflected in the other.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
operator fun get(key: String): JsonValue?

Returns the value of the mapping with the specified key.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open operator override fun iterator(): Iterator<Map.Entry<String, JsonValue>>
Link copied to clipboard
fun keySet(): Set<String>

Returns a set of the keys contained in this map. The set is backed by this map so changes to one are reflected by the other. The set does not support adding.

Link copied to clipboard
fun opt(key: String): JsonValue

Returns the optional value in the map with the specified key. If the value is not in the map JsonValue.NULL will be returned instead null.

Link copied to clipboard

Returns the required value in the map with the specified key. If the value is not in the map an exception will be thrown.

Link copied to clipboard
fun size(): Int

Returns the number of elements in this map.

Link copied to clipboard
open override fun toJsonValue(): JsonValue

Returns the objects represented as a JsonValue.

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

Returns the JsonMap as a JSON encoded String.

fun toString(sortKeys: Boolean): String

Returns the JsonMap as a JSON encoded String with sorted keys.

Link copied to clipboard

Returns a collection of the values contained in this map.

Link copied to clipboard
fun write(stringer: JSONStringer, sortKeys: Boolean)

Helper method that is used to write the value as a JSON String.

Inherited functions

Link copied to clipboard
fun JsonMap.extend(vararg fields: Pair<String, *>): JsonMap
Link copied to clipboard
fun JsonMap.isoDateAsMilliseconds(key: String, defaultValue: Long? = null): Long?

Gets the field with the given key and parses it as a ISO date string.

Link copied to clipboard
inline fun <T> JsonMap.optionalField(key: String): T?

Gets the field with the given key from the JsonMap, or null if not defined.

Link copied to clipboard

Gets a list with the given key from the JsonMap, or an null if not defined.

Link copied to clipboard

Gets a map with the given key from the JsonMap, or an null if not defined.

Link copied to clipboard
inline fun <T> JsonMap.requireField(key: String): T

Gets the field with the given key from the JsonMap, ensuring it is non-null.

Link copied to clipboard

Gets a list with the given key from the JsonMap.

Link copied to clipboard

Gets a map with the given key from the JsonMap.