Package javax.json
Interface JsonObject
-
- All Superinterfaces:
JsonStructure
,JsonValue
,java.util.Map<java.lang.String,JsonValue>
public interface JsonObject extends JsonStructure, java.util.Map<java.lang.String,JsonValue>
A JsonObject, e.g.{ "name":"karl", "age":38, "address": { "street":"dummystreet" "housenumber":12 } }
A JsonObject is always also a Map which uses the attribute names as key mapping to their JsonValues.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.json.JsonValue
JsonValue.ValueType
-
-
Field Summary
-
Fields inherited from interface javax.json.JsonValue
EMPTY_JSON_ARRAY, EMPTY_JSON_OBJECT, FALSE, NULL, TRUE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
getBoolean(java.lang.String name)
boolean
getBoolean(java.lang.String name, boolean defaultValue)
int
getInt(java.lang.String name)
int
getInt(java.lang.String name, int defaultValue)
JsonArray
getJsonArray(java.lang.String name)
JsonNumber
getJsonNumber(java.lang.String name)
JsonObject
getJsonObject(java.lang.String name)
JsonString
getJsonString(java.lang.String name)
java.lang.String
getString(java.lang.String name)
java.lang.String
getString(java.lang.String name, java.lang.String defaultValue)
boolean
isNull(java.lang.String name)
-
Methods inherited from interface javax.json.JsonStructure
getValue
-
Methods inherited from interface javax.json.JsonValue
asJsonArray, asJsonObject, getValueType, toString
-
-
-
-
Method Detail
-
getJsonArray
JsonArray getJsonArray(java.lang.String name)
- Returns:
- the JsonArray with the given name or
null
if there is no attribute with that name - Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly cast
-
getJsonObject
JsonObject getJsonObject(java.lang.String name)
- Returns:
- the JsonObject with the given name or
null
if there is no attribute with that name - Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly cast
-
getJsonNumber
JsonNumber getJsonNumber(java.lang.String name)
- Returns:
- the JsonNumber with the given name or
null
if there is no attribute with that name - Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly cast
-
getJsonString
JsonString getJsonString(java.lang.String name)
- Returns:
- the JsonString with the given name or
null
if there is no attribute with that name - Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly cast
-
getString
java.lang.String getString(java.lang.String name)
- Returns:
- the native string with the given name or
null
if there is no attribute with that name - Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly cast
-
getString
java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
- Returns:
- the native string with the given name or the default value if there is no attribute with that name
- Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly cast
-
getInt
int getInt(java.lang.String name)
- Returns:
- the int with the given name or
null
if there is no attribute with that name - Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly castjava.lang.NullPointerException
- if an object with the given name doesn't exist
-
getInt
int getInt(java.lang.String name, int defaultValue)
- Returns:
- the int with the given name or the default value if there is no attribute with that name
- Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly cast
-
getBoolean
boolean getBoolean(java.lang.String name)
- Returns:
- the boolean with the given name or
null
if there is no attribute with that name - Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly castjava.lang.NullPointerException
- if an object with the given name doesn't exist
-
getBoolean
boolean getBoolean(java.lang.String name, boolean defaultValue)
- Returns:
- the boolean with the given name or the default value if there is no attribute with that name
- Throws:
java.lang.ClassCastException
- if the JsonValue cannot be correctly cast
-
isNull
boolean isNull(java.lang.String name)
- Returns:
- whether the attribute with the given name is
JsonValue.NULL
-
-