java.lang.Object | |
↳ | com.urbanairship.json.JsonMap |
An immutable mapping of String keys to JsonValues.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | JsonMap.Builder | Builder class for JsonMap Objects. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final JsonMap | EMPTY_MAP |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
JsonMap(Map<String, JsonValue> map)
Creates a JsonMap from a Map.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
containsKey(String key)
Returns whether this map contains the specified key.
| ||||||||||
boolean |
containsValue(JsonValue value)
Returns whether this map contains the specified value.
| ||||||||||
Set<Entry<String, JsonValue>> |
entrySet()
Returns a set containing all of the mappings in this map.
| ||||||||||
boolean | equals(Object object) | ||||||||||
JsonValue |
get(String key)
Returns the value of the mapping with the specified key.
| ||||||||||
Map<String, JsonValue> |
getMap()
Gets the JsonMap as a Map.
| ||||||||||
int | hashCode() | ||||||||||
boolean |
isEmpty()
Returns whether this map is empty.
| ||||||||||
Iterator<Entry<String, JsonValue>> | iterator() | ||||||||||
Set<String> |
keySet()
Returns a set of the keys contained in this map.
| ||||||||||
static JsonMap.Builder |
newBuilder()
Factory method to create a new JSON map builder.
| ||||||||||
JsonValue |
opt(String key)
Returns the optional value in the map with the specified key.
| ||||||||||
JsonValue |
require(String key)
Returns the required value in the map with the specified key.
| ||||||||||
int |
size()
Returns the number of elements in this map.
| ||||||||||
JsonValue |
toJsonValue()
Returns the objects represented as a JsonValue.
| ||||||||||
String |
toString()
Returns the JsonMap as a JSON encoded String.
| ||||||||||
Collection<JsonValue> |
values()
Returns a collection of the values contained in this map.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.urbanairship.json.JsonSerializable
| |||||||||||
From interface
java.lang.Iterable
|
Creates a JsonMap from a Map.
map | A map of strings to JsonValues. |
---|
Returns whether this map contains the specified key.
key | the key to search for. |
---|
true
if this map contains the specified key,
false
otherwise.
Returns whether this map contains the specified value.
value | the value to search for. |
---|
true
if this map contains the specified value,
false
otherwise.
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.
Returns the value of the mapping with the specified key.
key | the key. |
---|
null
if no mapping for the specified key is found.
Returns whether this map is empty.
true
if this map has no elements, false
otherwise.
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.
Factory method to create a new JSON map builder.
Returns the required value in the map with the specified key. If the value is not in the map an exception will be thrown.
key | the key. |
---|
JsonException | if the value is not in the map. |
---|
Returns the number of elements in this map.
Returns the objects represented as a JsonValue.
Returns the JsonMap as a JSON encoded String.
Returns a collection of the values contained in this map.