Class PartialList<T>

  • Type Parameters:
    T - the generic type of contained elements
    All Implemented Interfaces:
    Serializable

    public class PartialList<T>
    extends Object
    implements Serializable
    A list of elements representing a limited view of a larger list, starting from a given element (offset from the first) and showing only a given number of elements, instead of showing all of them. This is useful to retrieve "pages" of large element collections.
    See Also:
    Serialized Form
    • Constructor Detail

      • PartialList

        public PartialList()
        Instantiates a new PartialList.
      • PartialList

        public PartialList​(List<T> list,
                           long offset,
                           long pageSize,
                           long totalSize,
                           PartialList.Relation totalSizeRelation)
        Instantiates a new PartialList.
        Parameters:
        list - the limited view into the bigger List this PartialList is representing
        offset - the offset of the first element in the view
        pageSize - the number of elements this PartialList contains
        totalSize - the total size of elements in the original List
        totalSizeRelation - the relation to the total size (equals or greater than)
    • Method Detail

      • getList

        public List<T> getList()
        Retrieves the limited list view.
        Returns:
        a List of the size elements starting from the offset-th one from the original, larger list
      • setList

        public void setList​(List<T> list)
        Sets the view list.
        Parameters:
        list - the view list into the bigger List this PartialList is representing
      • getOffset

        public long getOffset()
        Retrieves the offset of the first element of the view.
        Returns:
        the offset of the first element of the view
      • setOffset

        public void setOffset​(long offset)
      • getPageSize

        public long getPageSize()
        Retrieves the number of elements this PartialList contains.
        Returns:
        the number of elements this PartialList contains
      • setPageSize

        public void setPageSize​(long pageSize)
      • getTotalSize

        public long getTotalSize()
        Retrieves the total size of elements in the original List.
        Returns:
        the total size of elements in the original List
      • setTotalSize

        public void setTotalSize​(long totalSize)
      • size

        public int size()
        Retrieves the size of this PartialList. Should equal getPageSize().
        Returns:
        the size of this PartialList
      • get

        public T get​(int index)
        Retrieves the element at the specified index
        Parameters:
        index - the index of the element to retrieve
        Returns:
        the element at the specified index
      • getScrollIdentifier

        public String getScrollIdentifier()
        Retrieve the scroll identifier to make it possible to continue a scrolling list query
        Returns:
        a string containing the scroll identifier, to be sent back in an subsequent request
      • setScrollIdentifier

        public void setScrollIdentifier​(String scrollIdentifier)
      • getScrollTimeValidity

        public String getScrollTimeValidity()
        Retrieve the value of the scroll time validity to make it possible to continue a scrolling list query
        Returns:
        a string containing a time value for the scroll validity, to be sent back in a subsequent request
      • setScrollTimeValidity

        public void setScrollTimeValidity​(String scrollTimeValidity)
      • getTotalSizeRelation

        public PartialList.Relation getTotalSizeRelation()
        Retrieve the relation to the total site, wether it is equal to or greater than the value stored in the totalSize property.
        Returns:
        a Relation enum value that describes the type of total size we have in this object.
      • setTotalSizeRelation

        public void setTotalSizeRelation​(PartialList.Relation totalSizeRelation)