Interface JSONMapNode

All Superinterfaces:
Comparable<JSONNode>, JSONNode, Serializable
All Known Subinterfaces:
JSONObject

public interface JSONMapNode
extends JSONNode
  • Method Details

    • put

      void put​(String key, JSONValue<?> value)
      Add a key value pair to the map. If the named pair already exists, the value is updated
      Parameters:
      key - the entry name
      value - the JSONValue
    • put

      void put​(String key, Object value)
      Adds a key-value pair to the map. Values can be of any valid value type and will be converted to the appropriate JSONValue<?> instance
      Parameters:
      key - the entry name
      value - the value
      Throws:
      JSONInvalidValueTypeException - thrown if the value is not a valid value type (see JSONValueType)
    • put

      void put​(String key, Object... value)
    • putAll

      void putAll​(Map<String,​JSONValue<?>> map)
      Parameters:
      map - A map of Key-JSONValue pairs
    • putAllRaw

      void putAllRaw​(Map<String,​Object> map)
      Imports a generic map and creates an internal map representation of String, JSONValue<?> pairs
      Parameters:
      map - the associative array map object containing the key value pairs to import
      Throws:
      JSONInvalidValueTypeException - thrown if any of the values is not a valid value type (see JSONValueType)
    • clear

      void clear()
      Clears all values from this mapped object
    • size

      int size()
      returns the number of entries in this mapped object
      Returns:
      the size of the current map's entries
    • values

      Collection<JSONValue<?>> values()
      Returns an interable collection of all the map's values
      Returns:
      an iterable collection of all the maps values
    • valueList

      <V> List<V> valueList()
    • keys

      Iterable<String> keys()
    • keySet

      Iterator<String> keySet()
    • get

      JSONValue<?> get​(String key)
      Returns a value based on a specific key
      Parameters:
      key - the entry's key
      Returns:
      the value of the entry
      Throws:
      JSONValueNotFoundException - thrown when the value is not found
    • getMap

      Map<String,​Object> getMap()
      Serializes the internal map's String, JSONValue<?> pairs into a generic map of String, Object pairs. Useful when you need to integrate with other code that doesn't work with JSONValue objects
      Returns:
      a Map of String, Object pairs
    • elements

      Set<Map.Entry<String,​JSONValue<?>>> elements()
      Returns the set of the map's String, JSONValue pairs
      Returns:
      the set of the map's String, JSONValue pairs
    • names

      String[] names()
      Returns an array of each entry's keys
      Returns:
      a String array of each entry's keys
    • containsKey

      boolean containsKey​(String key)
      Returns whether or not a named entry exists in the map
      Parameters:
      key - the key to evaluate
      Returns:
      true if the key exists; false otherwise
    • remove

      JSONValue<?> remove​(String key)
      Removes an entry from the map
      Parameters:
      key - the specified entry's key
      Returns:
      The entry's value
    • isNull

      default boolean isNull​(String key)
      Returns if the specified key is null, or doesn't exist
      Parameters:
      key - the value key
      Returns:
      true if the value for the key is null, or if the key doesn't exist