Class JsonObjectImpl

    • Constructor Detail

      • JsonObjectImpl

        public JsonObjectImpl()
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Description copied from interface: JsonObject
        Checks if object has any attribute.
        Specified by:
        isEmpty in interface JsonObject
        Returns:
        true if object has no attribute
      • size

        public int size()
        Description copied from interface: JsonObject
        Size of json object.
        Specified by:
        size in interface JsonObject
        Returns:
        number of attributes.
      • clear

        public void clear()
        Description copied from interface: JsonObject
        Clears all attributes from this json object.
        Specified by:
        clear in interface JsonObject
      • attr

        public JsonAttribute attr​(int index)
        Description copied from interface: JsonObject
        Reads n'th attribute of this json object
        Specified by:
        attr in interface JsonObject
        Parameters:
        index - of the attribute which is read (first attribute has index=0)
        Returns:
        attribute at index position
      • first

        public JsonValue first()
        Description copied from interface: JsonObject
        Returns value of first attribute.
        Specified by:
        first in interface JsonObject
        Returns:
        first attribute value or null if json object is empty
      • last

        public JsonValue last()
        Description copied from interface: JsonObject
        Returns value of last attribute.
        Specified by:
        last in interface JsonObject
        Returns:
        last attribute value or null if json object is empty
      • removeAttr

        public JsonAttribute removeAttr​(int index)
        Description copied from interface: JsonObject
        Removes n'th attribute from this json object.
        Specified by:
        removeAttr in interface JsonObject
        Parameters:
        index - position of attribute which should be removed
        Returns:
        remoced attribute
      • add

        public JsonObject add​(String name,
                              JsonValue value)
        Description copied from interface: JsonObject
        Adds attribute ti this json object at last position.
        Specified by:
        add in interface JsonObject
        Parameters:
        name - name of the attribute
        value - value of the attribute
        Returns:
        this json object
      • add

        public JsonObject add​(String name,
                              JsonValue value,
                              int index)
        Description copied from interface: JsonObject
        Adds attribute ti this json object at specified position.
        Specified by:
        add in interface JsonObject
        Parameters:
        name - name of the attribute
        value - value of the attribute
        index - position of the attribute
        Returns:
        this json object
      • firstIndex

        public int firstIndex​(String name)
        Description copied from interface: JsonObject
        Index of first attribute with specidied name
        Specified by:
        firstIndex in interface JsonObject
        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

        public JsonValue first​(String name)
        Description copied from interface: JsonObject
        Value of first attribute with specidied name
        Specified by:
        first in interface JsonObject
        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

        public List<JsonValue> all​(String name)
        Description copied from interface: JsonObject
        Values of all attributes with specidied name
        Specified by:
        all in interface JsonObject
        Parameters:
        name - name of the attributes which should be found
        Returns:
        values of all attributes with the name
      • removeAll

        public JsonObject removeAll​(String name)
        Description copied from interface: JsonObject
        Removes all values with specified name.
        Specified by:
        removeAll in interface JsonObject
        Parameters:
        name - of attributes to be removed
        Returns:
        this json object
      • attr

        public JsonAttribute attr​(String name)
        Description copied from interface: JsonObject
        Reads first attribute of this json object with specified name
        Specified by:
        attr in interface JsonObject
        Parameters:
        name - of the attribute which is read (first attribute with the name will be returned)
        Returns:
        first attribute with the name
      • attrs

        public List<JsonAttribute> attrs​(String name)
        Description copied from interface: JsonObject
        Reads all attributes of this json object with specified name
        Specified by:
        attrs in interface JsonObject
        Parameters:
        name - of the attributes which is read (all attributes with the name will be returned)
        Returns:
        all attributes with the name
      • copy

        public JsonValue copy()
        Description copied from interface: JsonValue
        Makes deep copy of this value.
        Specified by:
        copy in interface JsonValue
        Returns:
        copy of this
      • asTemplateParam

        public Object asTemplateParam()
        Description copied from interface: JsonValue
        Converts value to value usable for some template frameworks. - JsonObjects is converted to read only Map - JsonArray is converted to read only List - JsonLiteral is converted to its java value
        Specified by:
        asTemplateParam in interface JsonValue
        Returns:
        template parameter form of this value