Class JsonArrayImpl

    • Constructor Detail

      • JsonArrayImpl

        public JsonArrayImpl()
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Description copied from interface: JsonArray
        Checks if this json array contains no value.
        Specified by:
        isEmpty in interface JsonArray
        Returns:
        true if json array is empty.
      • size

        public int size()
        Description copied from interface: JsonArray
        Size of json array.
        Specified by:
        size in interface JsonArray
        Returns:
        size of json array.
      • clear

        public void clear()
        Description copied from interface: JsonArray
        Clears content of json array.
        Specified by:
        clear in interface JsonArray
      • get

        public JsonValue get​(int index)
        Description copied from interface: JsonArray
        Reads n'th item from json array.
        Specified by:
        get in interface JsonArray
        Parameters:
        index - order if returned item (first element has index=0)
        Returns:
        element of json array at 'index' position
      • remove

        public JsonValue remove​(int index)
        Description copied from interface: JsonArray
        Removes n'th element from json array.
        Specified by:
        remove in interface JsonArray
        Parameters:
        index - position of element in json array which should be removed
        Returns:
        removed element
      • first

        public JsonValue first()
        Description copied from interface: JsonArray
        Reads first element of json array.
        Specified by:
        first in interface JsonArray
        Returns:
        first element of json array or null if array is empty.
      • last

        public JsonValue last()
        Description copied from interface: JsonArray
        Reads last element of json array.
        Specified by:
        last in interface JsonArray
        Returns:
        last element of json array or null if array is empty.
      • add

        public JsonArray add​(JsonValue value)
        Description copied from interface: JsonArray
        Adds new element to json array.
        Specified by:
        add in interface JsonArray
        Parameters:
        value - value to be added to the array. Should not be empty
        Returns:
        this json array instance
      • add

        public JsonArray add​(JsonValue value,
                             int index)
        Description copied from interface: JsonArray
        Adds new element to json array at specified position.
        Specified by:
        add in interface JsonArray
        Parameters:
        value - value to be added to the array. Should not be empty
        index - position where value should be added;
        Returns:
        this json array instance
      • toList

        public List<JsonValue> toList()
        Description copied from interface: JsonArray
        Converts this instance to regulat list of values.
        Specified by:
        toList in interface JsonArray
        Returns:
        list of json array values.
      • remove

        public void remove​(JsonValue value)
      • 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