Interface JsonObjectNode

All Superinterfaces:
JsonNode

public interface JsonObjectNode extends 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 Details

    • getValue

      Map<String,JsonNode> getValue()
      Description copied from interface: JsonNode
      Retrieves the value for this JsonNode.
      Specified by:
      getValue in interface JsonNode
      Returns:
      The value for this JsonNode.
    • asMap

      Map<String,JsonNode> asMap()
      Retrieves the value for this JsonNode.
      Returns:
      The value for this JsonNode.
    • put

      void put(String key, JsonNode value)
      Puts a JsonNode into this JsonObjectNode.
      Parameters:
      key - The key to use.
      value - The JsonNode that the key should point to.
    • putString

      void putString(String key, String value)
      Puts a string into this JsonObjectNode.
      Parameters:
      key - The key to use.
      value - The string value that the key should point to.
      Throws:
      NullPointerException - if the value is null.
    • putBoolean

      void putBoolean(String key, boolean value)
      Puts a double into this JsonObjectNode.
      Parameters:
      key - The key to use.
      value - The boolean value that the key should point to.
    • putNumber

      void putNumber(String key, long value)
      Puts a long into this JsonObjectNode.
      Parameters:
      key - The key to use.
      value - The long value that the key should point to.
    • putNumber

      void putNumber(String key, double value)
      Puts a double into this JsonObjectNode.
      Parameters:
      key - The key to use.
      value - The double value that the key should point to.
    • putNumber

      void putNumber(String key, Number value)
      Puts a number into this JsonObjectNode.
      Parameters:
      key - The key to use.
      value - The number value that the key should point to.
    • get

      JsonNode get(String key)
      Attempts to return the JsonNode for the given key.
      Parameters:
      key - The key to retrieve.
      Returns:
      The JsonNode for the given key.
    • getString

      String getString(String key)
      Attempts to return the string for the given key.
      Parameters:
      key - The key to retrieve.
      Returns:
      The string for the given key, or null if it is not a String, or if it is not present.
    • getBoolean

      Boolean getBoolean(String key)
      Attempts to return the boolean for the given key.
      Parameters:
      key - The key to retrieve.
      Returns:
      The boolean for the given key, or null if it is not a Boolean, or if it is not present.
    • getLong

      Long getLong(String key)
      Attempts to return the number for the given key as a long.
      Parameters:
      key - The key to retrieve.
      Returns:
      The number at the given key as a long, or null if it is not a Long, or if it is not present.
    • getDouble

      Double getDouble(String key)
      Attempts to return the number for the given key as a double.
      Parameters:
      key - The key to retrieve.
      Returns:
      The number for the given key as a double, or null if it is not a Double, or if it is not present.
    • getNumber

      Number getNumber(String key)
      Attempts to return the number for the given key.
      Parameters:
      key - The key to retrieve.
      Returns:
      The number for the given key, or null if it is not a Number, or if it is not present.
    • remove

      void remove(String key)
      Removes the given key and corresponding JsonNode from the object.
      Parameters:
      key - The key to remove.
    • has

      boolean has(String key)
      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

      boolean hasString(String key)
      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

      boolean hasBoolean(String key)
      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

      boolean hasNumber(String key)
      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

      boolean hasArray(String key)
      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

      boolean hasObject(String key)
      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

      static JsonObjectNode jsonObjectNode()
      Creates a new empty instance of JsonObjectNode.
      Returns:
      A new JsonObjectNode instance.
    • jsonObjectNode

      static JsonObjectNode jsonObjectNode(Map<String,? extends JsonNode> value)
      Creates a new instance of JsonObjectNode from the supplied map of String to JsonNode.
      Parameters:
      value - The map of String to JsonNode.
      Returns:
      A new JsonNode instance.