Interface JsonObject
- All Superinterfaces:
JsonValue
Represents a Json object. Abstracted from javax.json (J2EE) and Jersey.
- Author:
- Holger Eichelberger, SSE
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) Returns whether this object contains a certain key.booleangetBoolean(String name) Returns the boolean value of the associated mapping for the specified name.intReturns the int value of the associated mapping for the specified name.getJsonArray(String name) Returns the object array to which the specified name is mapped.getJsonNumber(String name) Returns the number to which the specified name is mapped.getJsonObject(String name) Returns the object value to which the specified name is mapped.getJsonString(String name) Returns the string to which the specified name is mapped.Returns the string value of the associated mapping for the specified name.Returns the value of the associated mapping for the specified name.booleanisEmpty()Returnstrueif this object contains no key-value mappings.booleanReturnstrueif the associated value for the specified name is a JSON null.keys()Returns the keys of the key-value pairs of this object.Methods inherited from interface de.iip_ecosphere.platform.support.json.JsonValue
asJsonObject
-
Method Details
-
getJsonObject
Returns the object value to which the specified name is mapped.- Parameters:
name- the name whose associated value is to be returned- Returns:
- the object value to which the specified name is mapped, or null if this object contains no
mapping for
name - Throws:
ClassCastException- if the value to which the specifiednameis mapped is not assignable toJsonObjecttype
-
getJsonArray
Returns the object array to which the specified name is mapped.- Parameters:
name- the name whose associated array is to be returned- Returns:
- the array value to which the specified name is mapped, or null if this object contains no
mapping for
name - Throws:
ClassCastException- if the value to which the specifiednameis mapped is not assignable toJsonArraytype
-
getJsonNumber
Returns the number to which the specified name is mapped.- Parameters:
name- the name whose associated number is to be returned- Returns:
- the number to which the specified name is mapped, or null if this object contains no
mapping for
name - Throws:
ClassCastException- if the value to which the specifiednameis mapped is not assignable toJsonNumbertype
-
getJsonString
Returns the string to which the specified name is mapped.- Parameters:
name- the name whose associated string is to be returned- Returns:
- the string to which the specified name is mapped, or null if this object contains no
mapping for
name - Throws:
ClassCastException- if the value to which the specifiednameis mapped is not assignable toJsonStringtype
-
getString
Returns the string value of the associated mapping for the specified name.- Parameters:
name- whose associated value is to be returned as string- Returns:
- the string value to which the specified name is mapped
- Throws:
NullPointerException- if the specified name doesn't have any mappingClassCastException- if the value for specified name mapping is not assignable
-
getInt
Returns the int value of the associated mapping for the specified name.- Parameters:
name- whose associated value is to be returned as int- Returns:
- the int value to which the specified name is mapped
- Throws:
NullPointerException- if the specified name doesn't have any mappingClassCastException- if the value for specified name mapping is not assignable
-
getBoolean
Returns the boolean value of the associated mapping for the specified name.- Parameters:
name- whose associated value is to be returned as boolean- Returns:
- the boolean value to which the specified name is mapped
- Throws:
NullPointerException- if the specified name doesn't have any mappingClassCastException- if the value for specified name mapping is not assignable
-
isNull
Returnstrueif the associated value for the specified name is a JSON null.- Parameters:
name- name whose associated value is checked- Returns:
- return
trueif the associated value is JSON null, otherwisefalse - Throws:
NullPointerException- if the specified name doesn't have anymapping
-
getValue
Returns the value of the associated mapping for the specified name.- Parameters:
name- whose associated value is to be returned as boolean- Returns:
- the value to which the specified name is mapped
- Throws:
NullPointerException- if the specified name doesn't have any mappingClassCastException- if the value for specified name mapping is not assignable
-
isEmpty
boolean isEmpty()Returnstrueif this object contains no key-value mappings.- Returns:
trueif this object contains no key-value mappings
-
keys
Returns the keys of the key-value pairs of this object.- Returns:
- the keys
-
containsKey
Returns whether this object contains a certain key.- Parameters:
key- the key- Returns:
truefor contains,falseelse
-