Package org.apache.activemq.artemis.json
Interface JsonObject
- All Known Implementing Classes:
JsonObjectImpl
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 org.apache.activemq.artemis.json.JsonValue
JsonValue.ValueType -
Field Summary
Fields inherited from interface org.apache.activemq.artemis.json.JsonValue
EMPTY_JSON_ARRAY, EMPTY_JSON_OBJECT, FALSE, NULL, TRUE -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolean(String name) Returns the boolean with the given name ornullif there is no attribute with that name.booleangetBoolean(String name, boolean defaultValue) Returns the boolean with the given name or the default value if there is no attribute with that name.intReturns the int with the given name ornullif there is no attribute with that name.intReturns the int with the given name or the default value if there is no attribute with that name.getJsonArray(String name) Returns the JsonArray with the given name ornullif there is no attribute with that name.getJsonNumber(String name) Returns the JsonNumber with the given name ornullif there is no attribute with that name.getJsonObject(String name) Returns the JsonObject with the given name ornullif there is no attribute with that name.getJsonString(String name) Returns the JsonString with the given name ornullif there is no attribute with that name.Returns the native string with the given name ornullif there is no attribute with that name.Returns the native string with the given name or the default value if there is no attribute with that name.booleanReturns whether the attribute with the given name isJsonValue.NULL.Methods inherited from interface org.apache.activemq.artemis.json.JsonValue
asJsonArray, asJsonObject, getValueType, toStringMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
getJsonArray
Returns the JsonArray with the given name ornullif there is no attribute with that name.- Returns:
- the JsonArray with the given name or
nullif there is no attribute with that name - Throws:
ClassCastException- if the JsonValue cannot be correctly cast
-
getJsonObject
Returns the JsonObject with the given name ornullif there is no attribute with that name.- Returns:
- the JsonObject with the given name or
nullif there is no attribute with that name - Throws:
ClassCastException- if the JsonValue cannot be correctly cast
-
getJsonNumber
Returns the JsonNumber with the given name ornullif there is no attribute with that name.- Returns:
- the JsonNumber with the given name or
nullif there is no attribute with that name - Throws:
ClassCastException- if the JsonValue cannot be correctly cast
-
getJsonString
Returns the JsonString with the given name ornullif there is no attribute with that name.- Returns:
- the JsonString with the given name or
nullif there is no attribute with that name - Throws:
ClassCastException- if the JsonValue cannot be correctly cast
-
getString
Returns the native string with the given name ornullif there is no attribute with that name.- Returns:
- the native string with the given name or
nullif there is no attribute with that name - Throws:
ClassCastException- if the JsonValue cannot be correctly cast
-
getString
Returns the native string with the given name or the default value if there is no attribute with that name.- Returns:
- the native string with the given name or the default value if there is no attribute with that name
- Throws:
ClassCastException- if the JsonValue cannot be correctly cast
-
getInt
Returns the int with the given name ornullif there is no attribute with that name.- Returns:
- the int with the given name or
nullif there is no attribute with that name - Throws:
ClassCastException- if the JsonValue cannot be correctly castNullPointerException- if an object with the given name doesn't exist
-
getInt
Returns the int with the given name or the default value if there is no attribute with that name.- Returns:
- the int with the given name or the default value if there is no attribute with that name
- Throws:
ClassCastException- if the JsonValue cannot be correctly cast
-
getBoolean
Returns the boolean with the given name ornullif there is no attribute with that name.- Returns:
- the boolean with the given name or
nullif there is no attribute with that name - Throws:
ClassCastException- if the JsonValue cannot be correctly castNullPointerException- if an object with the given name doesn't exist
-
getBoolean
Returns the boolean with the given name or the default value if there is no attribute with that name.- Returns:
- the boolean with the given name or the default value if there is no attribute with that name
- Throws:
ClassCastException- if the JsonValue cannot be correctly cast
-
isNull
Returns whether the attribute with the given name isJsonValue.NULL.- Returns:
- whether the attribute with the given name is
JsonValue.NULL
-