Package org.appng.api

Class DataContainer

    • Method Detail

      • getItem

        public Object getItem()
        Returns the single item
        Returns:
        the item
      • setItem

        public void setItem​(Object item)
        Sets the single item
        Parameters:
        item - the item
      • isSingleResult

        public boolean isSingleResult()
        Returns whether this DataContainer contains only a single item
        Returns:
        true if this DataContainer only contains a single result which has been set via setItem(Object)
      • getItems

        public Collection<?> getItems()
        Returns the items previously set via one of the setItems(...) -methods
        Returns:
        the items
      • setItems

        public void setItems​(Collection<?> items)
        Sets the Collection of items for this DataContainer. Note that paging and sorting is not supported when using this method.
        Parameters:
        items - a Collection of items
      • setPage

        public void setPage​(Collection<?> items,
                            org.springframework.data.domain.Pageable pageable)
        Sets the Page for this DataContainer, which is being extracted from the given Collection of items, based on the given Pageable. See setPage(Collection, Pageable, boolean) for details.
        Parameters:
        items - the Collection of items the extract the Page from
        pageable - the Pageable for the Page to extract
        See Also:
        setPage(Collection, Pageable, boolean)
      • setPage

        public void setPage​(Collection<?> items,
                            org.springframework.data.domain.Pageable pageable,
                            boolean skipSort)
        Sets the Page for this DataContainer, which is being extracted from the given Collection of items, based on the given Pageable.
        For example, if there are 15 items in the collection, and the Pageable requests (the 0-based) page 1 with a pagesize of 10, the resulting page will contain the (1-based) elements 11 to 15.
        If the Pageable has a Sort property set, the items will be sorted before extracting the page.

        Note that sorting the items is done by using Java Reflection-API, thus for performance reasons it is not recommended to apply sorting to very large collections. Such collections should be pre-sorted before in a non-reflective way (then skipSort should be set to true).

        Parameters:
        items - the Collection of items the extract the Page from
        pageable - the Pageable for the Page to extract
        skipSort - if the items should not get sorted, even if the pageable has a Sort property set
      • getPageable

        public org.springframework.data.domain.Pageable getPageable()
        Returns the Pageable (may be null) for this DataContainer
        Returns:
        the Pageable, if any
        See Also:
        setPage(Page), setPage(Collection, Pageable)
      • setPage

        public void setPage​(org.springframework.data.domain.Page<?> page)
        Sets the Page for this DataContainer
        Parameters:
        page - the Page to set
      • getWrappedData

        public Data getWrappedData()
        Returns the Data wrapped within this DataContainer
        Returns:
        the Data