Interface JsonObject

    • Method Detail

      • isEmpty

        boolean isEmpty()
        Checks if object has any attribute.
        Returns:
        true if object has no attribute
      • size

        int size()
        Size of json object.
        Returns:
        number of attributes.
      • clear

        void clear()
        Clears all attributes from this json object.
      • attr

        JsonAttribute attr​(int index)
        Reads n'th attribute of this json object
        Parameters:
        index - of the attribute which is read (first attribute has index=0)
        Returns:
        attribute at index position
      • attr

        JsonAttribute attr​(String name)
        Reads first attribute of this json object with specified name
        Parameters:
        name - of the attribute which is read (first attribute with the name will be returned)
        Returns:
        first attribute with the name
      • attrs

        List<JsonAttribute> attrs​(String name)
        Reads all attributes of this json object with specified name
        Parameters:
        name - of the attributes which is read (all attributes with the name will be returned)
        Returns:
        all attributes with the name
      • removeAttr

        JsonAttribute removeAttr​(int index)
        Removes n'th attribute from this json object.
        Parameters:
        index - position of attribute which should be removed
        Returns:
        remoced attribute
      • first

        JsonValue first()
        Returns value of first attribute.
        Returns:
        first attribute value or null if json object is empty
      • last

        JsonValue last()
        Returns value of last attribute.
        Returns:
        last attribute value or null if json object is empty
      • add

        JsonObject add​(String name,
                       JsonValue value)
        Adds attribute ti this json object at last position.
        Parameters:
        name - name of the attribute
        value - value of the attribute
        Returns:
        this json object
      • add

        JsonObject add​(String name,
                       JsonValue value,
                       int index)
        Adds attribute ti this json object at specified position.
        Parameters:
        name - name of the attribute
        value - value of the attribute
        index - position of the attribute
        Returns:
        this json object
      • firstIndex

        int firstIndex​(String name)
        Index of first attribute with specidied name
        Parameters:
        name - name of the attribute which should be found
        Returns:
        index fist attribute with the name of null if it is not found
      • first

        JsonValue first​(String name)
        Value of first attribute with specidied name
        Parameters:
        name - name of the attribute which should be found
        Returns:
        value of fist attribute with the name of null if it is not found
      • all

        List<JsonValue> all​(String name)
        Values of all attributes with specidied name
        Parameters:
        name - name of the attributes which should be found
        Returns:
        values of all attributes with the name
      • removeAll

        JsonObject removeAll​(String name)
        Removes all values with specified name.
        Parameters:
        name - of attributes to be removed
        Returns:
        this json object