Interface JsonObjectNode
- All Superinterfaces:
JsonNode
This interface is used to define a JSON object node.
Note: The underlying map can be accessed. Changes to this map are shown on the Node. You can operate on a copy of the map to avoid this behavior.
-
Method Summary
Modifier and TypeMethodDescriptionasMap()Retrieves the value for thisJsonNode.Attempts to return the JsonNode for the given key.getBoolean(String key) Attempts to return the boolean for the given key.Attempts to return the number for the given key as a double.Attempts to return the number for the given key as a long.Attempts to return the number for the given key.Attempts to return the string for the given key.getValue()Retrieves the value for thisJsonNode.booleanDetermines if the object contains the given key.booleanDetermines if the object contains the given key, and if the corresponding value is an array.booleanhasBoolean(String key) Determines if the object contains the given key, and if the corresponding value is a boolean.booleanDetermines if the object contains the given key, and if the corresponding value is a number.booleanDetermines if the object contains the given key, and if the corresponding value is an object.booleanDetermines if the object contains the given key, and if the corresponding value is a string.static JsonObjectNodeCreates a new empty instance ofJsonObjectNode.static JsonObjectNodejsonObjectNode(Map<String, ? extends JsonNode> value) Creates a new instance ofJsonObjectNodefrom the supplied map of String toJsonNode.voidPuts aJsonNodeinto thisJsonObjectNode.voidputBoolean(String key, boolean value) Puts a double into thisJsonObjectNode.voidPuts a double into thisJsonObjectNode.voidPuts a long into thisJsonObjectNode.voidPuts a number into thisJsonObjectNode.voidPuts a string into thisJsonObjectNode.voidRemoves the given key and corresponding JsonNode from the object.
-
Method Details
-
getValue
-
asMap
-
put
Puts aJsonNodeinto thisJsonObjectNode.- Parameters:
key- The key to use.value- The JsonNode that the key should point to.
-
putString
Puts a string into thisJsonObjectNode.- Parameters:
key- The key to use.value- The string value that the key should point to.- Throws:
NullPointerException- if the value is null.
-
putBoolean
Puts a double into thisJsonObjectNode.- Parameters:
key- The key to use.value- The boolean value that the key should point to.
-
putNumber
Puts a long into thisJsonObjectNode.- Parameters:
key- The key to use.value- The long value that the key should point to.
-
putNumber
Puts a double into thisJsonObjectNode.- Parameters:
key- The key to use.value- The double value that the key should point to.
-
putNumber
Puts a number into thisJsonObjectNode.- Parameters:
key- The key to use.value- The number value that the key should point to.
-
get
-
getString
-
getBoolean
-
getLong
-
getDouble
-
getNumber
-
remove
Removes the given key and corresponding JsonNode from the object.- Parameters:
key- The key to remove.
-
has
Determines if the object contains the given key.- Parameters:
key- The key to check for.- Returns:
- True if the object contains the given key.
-
hasString
Determines if the object contains the given key, and if the corresponding value is a string.- Parameters:
key- The key to check for.- Returns:
- True if the object contains the given key, and the corresponding value is a string.
-
hasBoolean
Determines if the object contains the given key, and if the corresponding value is a boolean.- Parameters:
key- The key to check for.- Returns:
- True if the object contains the given key, and the corresponding value is a boolean.
-
hasNumber
Determines if the object contains the given key, and if the corresponding value is a number.- Parameters:
key- The key to check for.- Returns:
- True if the object contains the given key, and the corresponding value is a number.
-
hasArray
Determines if the object contains the given key, and if the corresponding value is an array.- Parameters:
key- The key to check for.- Returns:
- True if the object contains the given key, and the corresponding value is an array.
-
hasObject
Determines if the object contains the given key, and if the corresponding value is an object.- Parameters:
key- The key to check for.- Returns:
- True if the object contains the given key, and the corresponding value is an object.
-
jsonObjectNode
Creates a new empty instance ofJsonObjectNode.- Returns:
- A new
JsonObjectNodeinstance.
-
jsonObjectNode
Creates a new instance ofJsonObjectNodefrom the supplied map of String toJsonNode.
-