- All Implemented Interfaces:
Serializable,Cloneable,Map<String,,Object> SequencedMap<String,Object>
Extends a
LinkedHashMap with helper methods to determine the underlying JSON type of the map element.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionCreates an emptyJsonObjectwith the default capacity.JsonObject(int initialCapacity) Creates aJsonObjectwith the given initial capacity.JsonObject(int initialCapacity, float loadFactor) Creates aJsonObjectwith the given initial capacity and load factor.JsonObject(Map<? extends String, ?> map) Creates aJsonObjectfrom an existingMap. -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonBuilder<JsonObject> builder()Creates aJsonBuilderfor aJsonObject.Returns theJsonArrayat the given key, or null if it does not exist or is the wrong type.Returns theJsonArrayat the given key, or the default if it does not exist or is the wrong type.booleangetBoolean(String key) Returns theBooleanat the given key, or false if it does not exist or is the wrong type.booleangetBoolean(String key, Boolean default_) Returns theBooleanat the given key, or the default if it does not exist or is the wrong type.doubleReturns theDoubleat the given key, or 0.0 if it does not exist or is the wrong type.doubleReturns theDoubleat the given key, or the default if it does not exist or is the wrong type.floatReturns theFloatat the given key, or 0.0f if it does not exist or is the wrong type.floatReturns theFloatat the given key, or the default if it does not exist or is the wrong type.intReturns theIntegerat the given key, or 0 if it does not exist or is the wrong type.intReturns theIntegerat the given key, or the default if it does not exist or is the wrong type.longReturns theLongat the given key, or 0 if it does not exist or is the wrong type.longReturns theLongat the given key, or the default if it does not exist or is the wrong type.Returns theNumberat the given key, or null if it does not exist or is the wrong type.Returns theNumberat the given key, or the default if it does not exist or is the wrong type.Returns theJsonObjectat the given key, or null if it does not exist or is the wrong type.getObject(String key, JsonObject default_) Returns theJsonObjectat the given key, or the default if it does not exist or is the wrong type.Returns theStringat the given key, or null if it does not exist or is the wrong type.Returns theStringat the given key, or the default if it does not exist or is the wrong type.booleanReturns true if the object has an element at that key (even if that element is null).booleanReturns true if the object has a boolean element at that key.booleanReturns true if the object has a null element at that key.booleanReturns true if the object has a number element at that key.booleanReturns true if the object has a string element at that key.Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, removeEldestEntry, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Constructor Details
-
JsonObject
public JsonObject()Creates an emptyJsonObjectwith the default capacity. -
JsonObject
Creates aJsonObjectfrom an existingMap. -
JsonObject
public JsonObject(int initialCapacity) Creates aJsonObjectwith the given initial capacity. -
JsonObject
public JsonObject(int initialCapacity, float loadFactor) Creates aJsonObjectwith the given initial capacity and load factor.
-
-
Method Details
-
builder
Creates aJsonBuilderfor aJsonObject. -
getArray
Returns theJsonArrayat the given key, or null if it does not exist or is the wrong type. -
getArray
Returns theJsonArrayat the given key, or the default if it does not exist or is the wrong type. -
getBoolean
Returns theBooleanat the given key, or false if it does not exist or is the wrong type. -
getBoolean
Returns theBooleanat the given key, or the default if it does not exist or is the wrong type. -
getDouble
Returns theDoubleat the given key, or 0.0 if it does not exist or is the wrong type. -
getDouble
Returns theDoubleat the given key, or the default if it does not exist or is the wrong type. -
getFloat
Returns theFloatat the given key, or 0.0f if it does not exist or is the wrong type. -
getFloat
Returns theFloatat the given key, or the default if it does not exist or is the wrong type. -
getInt
Returns theIntegerat the given key, or 0 if it does not exist or is the wrong type. -
getInt
Returns theIntegerat the given key, or the default if it does not exist or is the wrong type. -
getLong
Returns theLongat the given key, or 0 if it does not exist or is the wrong type. -
getLong
Returns theLongat the given key, or the default if it does not exist or is the wrong type. -
getNumber
Returns theNumberat the given key, or null if it does not exist or is the wrong type. -
getNumber
Returns theNumberat the given key, or the default if it does not exist or is the wrong type. -
getObject
Returns theJsonObjectat the given key, or null if it does not exist or is the wrong type. -
getObject
Returns theJsonObjectat the given key, or the default if it does not exist or is the wrong type. -
getString
Returns theStringat the given key, or null if it does not exist or is the wrong type. -
getString
Returns theStringat the given key, or the default if it does not exist or is the wrong type. -
has
Returns true if the object has an element at that key (even if that element is null). -
isBoolean
Returns true if the object has a boolean element at that key. -
isNull
Returns true if the object has a null element at that key. -
isNumber
Returns true if the object has a number element at that key. -
isString
Returns true if the object has a string element at that key.
-