private static final class JsonObjectBuilderImpl.JsonObjectImpl extends java.util.AbstractMap<java.lang.String,JsonValue> implements JsonObject
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>JsonValue.ValueType| Modifier and Type | Field and Description |
|---|---|
private BufferPool |
bufferPool |
private java.util.Map<java.lang.String,JsonValue> |
valueMap |
| Constructor and Description |
|---|
JsonObjectImpl(java.util.Map<java.lang.String,JsonValue> valueMap,
BufferPool bufferPool) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.util.Map.Entry<java.lang.String,JsonValue>> |
entrySet() |
boolean |
getBoolean(java.lang.String name)
Returns the boolean value of the associated mapping for the specified
name.
|
boolean |
getBoolean(java.lang.String name,
boolean defaultValue)
Returns the boolean value of the associated mapping for the specified
name.
|
int |
getInt(java.lang.String name)
A convenience method for
getJsonNumber(name).intValue() |
int |
getInt(java.lang.String name,
int defaultValue)
Returns the int value of the associated
JsonNumber mapping
for the specified name. |
JsonArray |
getJsonArray(java.lang.String name)
Returns the array value to which the specified name is mapped.
|
JsonNumber |
getJsonNumber(java.lang.String name)
Returns the number value to which the specified name is mapped.
|
JsonObject |
getJsonObject(java.lang.String name)
Returns the object value to which the specified name is mapped.
|
JsonString |
getJsonString(java.lang.String name)
Returns the string value to which the specified name is mapped.
|
java.lang.String |
getString(java.lang.String name)
A convenience method for
getJsonString(name).getString() |
java.lang.String |
getString(java.lang.String name,
java.lang.String defaultValue)
Returns the string value of the associated
JsonString mapping
for the specified name. |
JsonValue.ValueType |
getValueType()
Returns the value type of this JSON value.
|
boolean |
isNull(java.lang.String name)
Returns
true if the associated value for the specified name is
JsonValue.NULL. |
java.lang.String |
toString()
Returns JSON text for this JSON value.
|
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, valuesprivate final java.util.Map<java.lang.String,JsonValue> valueMap
private final BufferPool bufferPool
JsonObjectImpl(java.util.Map<java.lang.String,JsonValue> valueMap, BufferPool bufferPool)
public JsonArray getJsonArray(java.lang.String name)
JsonObject(JsonArray)get(name) to
get the value.getJsonArray in interface JsonObjectname - the name whose associated value is to be returnednull if this object contains no mapping for the namepublic JsonObject getJsonObject(java.lang.String name)
JsonObject(JsonObject)get(name) to
get the value.getJsonObject in interface JsonObjectname - the name whose associated value is to be returnednull if this object contains no mapping for the namepublic JsonNumber getJsonNumber(java.lang.String name)
JsonObject(JsonNumber)get(name) to
get the value.getJsonNumber in interface JsonObjectname - the name whose associated value is to be returnednull if this object contains no mapping for the namepublic JsonString getJsonString(java.lang.String name)
JsonObject(JsonString)get(name) to
get the value.getJsonString in interface JsonObjectname - the name whose associated value is to be returnednull if this object contains no mapping for the namepublic java.lang.String getString(java.lang.String name)
JsonObjectgetJsonString(name).getString()getString in interface JsonObjectname - whose associated value is to be returned as Stringpublic java.lang.String getString(java.lang.String name,
java.lang.String defaultValue)
JsonObjectJsonString mapping
for the specified name. If JsonString is found, then its
JsonString.getString() is returned. Otherwise,
the specified default value is returned.getString in interface JsonObjectname - whose associated value is to be returned as StringdefaultValue - a default value to be returnedpublic int getInt(java.lang.String name)
JsonObjectgetJsonNumber(name).intValue()getInt in interface JsonObjectname - whose associated value is to be returned as intpublic int getInt(java.lang.String name,
int defaultValue)
JsonObjectJsonNumber mapping
for the specified name. If JsonNumber is found, then its
JsonNumber.intValue() is returned. Otherwise,
the specified default value is returned.getInt in interface JsonObjectname - whose associated value is to be returned as intdefaultValue - a default value to be returnedpublic boolean getBoolean(java.lang.String name)
JsonObjectgetBoolean in interface JsonObjectname - whose associated value is to be returned as booleanpublic boolean getBoolean(java.lang.String name,
boolean defaultValue)
JsonObjectgetBoolean in interface JsonObjectname - whose associated value is to be returned as intdefaultValue - a default value to be returnedpublic boolean isNull(java.lang.String name)
JsonObjecttrue if the associated value for the specified name is
JsonValue.NULL.isNull in interface JsonObjectname - name whose associated value is checkedJsonValue.NUL,
otherwise falsepublic JsonValue.ValueType getValueType()
JsonValuegetValueType in interface JsonValuepublic java.util.Set<java.util.Map.Entry<java.lang.String,JsonValue>> entrySet()