Class JSArrayImpl<T extends JSValue>

    • Constructor Detail

      • JSArrayImpl

        public JSArrayImpl​(String type,
                           com.fasterxml.jackson.databind.JsonNode node)
    • Method Detail

      • convertToElement

        protected abstract com.fasterxml.jackson.databind.JsonNode convertToElement​(T val)
        Parameters:
        val - external representation
        Returns:
        internal representation (json field name)
      • convertToT

        protected abstract T convertToT​(com.fasterxml.jackson.databind.JsonNode node)
        Parameters:
        node - representing the object
        Returns:
        external representation
      • preWrite

        public void preWrite()
        Description copied from interface: JSValue
        Called before we output the object. Objects MUST call all children to allow any processing before output - e.g. generate patches.
        Specified by:
        preWrite in interface JSValue
        Overrides:
        preWrite in class JSValueImpl
      • size

        public int size()
        Description copied from interface: JSArray
        Returns the number of elements in this array. If this array contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
        Specified by:
        size in interface JSArray<T extends JSValue>
        Returns:
        the number of elements in this array
      • get

        public List<T> get()
        Description copied from interface: JSArray
        Returns a list even though it's an array in json
        Specified by:
        get in interface JSArray<T extends JSValue>
        Returns:
        all the values or empty list
      • get

        public T get​(int index)
        Specified by:
        get in interface JSArray<T extends JSValue>
        Parameters:
        index - of entry
        Returns:
        the value throws JsforjException if index out of bounds
      • add

        public void add​(T val)
        Specified by:
        add in interface JSArray<T extends JSValue>
        Parameters:
        val - to be added to list
      • remove

        public void remove​(int index)
        Specified by:
        remove in interface JSArray<T extends JSValue>
        Parameters:
        index - of element to remove throws JsforjException if index out of bounds
      • remove

        public boolean remove​(T val)
        Specified by:
        remove in interface JSArray<T extends JSValue>
        Parameters:
        val - to remove
        Returns:
        false if not found
      • clear

        public void clear()
        Description copied from interface: JSValue
        Remove all contained properties and values
        Specified by:
        clear in interface JSValue
        Overrides:
        clear in class JSValueImpl