Class PagedList<E>

  • All Implemented Interfaces:
    java.lang.Iterable<E>

    public class PagedList<E>
    extends java.lang.Object
    implements java.lang.Iterable<E>
    Stores the result of a subset of data items from a source (such as EntityListIterator).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.List<E> data  
      protected int endIndex  
      protected int size  
      protected int startIndex  
      protected int viewIndex  
      protected int viewSize  
    • Constructor Summary

      Constructors 
      Constructor Description
      PagedList​(int startIndex, int endIndex, int size, int viewIndex, int viewSize, java.util.List<E> data)
      Default constructor - populates all fields in this class
    • Field Detail

      • startIndex

        protected int startIndex
      • endIndex

        protected int endIndex
      • size

        protected int size
      • viewIndex

        protected int viewIndex
      • viewSize

        protected int viewSize
      • data

        protected java.util.List<E> data
    • Constructor Detail

      • PagedList

        public PagedList​(int startIndex,
                         int endIndex,
                         int size,
                         int viewIndex,
                         int viewSize,
                         java.util.List<E> data)
        Default constructor - populates all fields in this class
        Parameters:
        startIndex -
        endIndex -
        size -
        viewIndex -
        viewSize -
        data -
    • Method Detail

      • empty

        public static <E> PagedList<E> empty​(int viewIndex,
                                             int viewSize)
        Parameters:
        viewIndex -
        viewSize -
        Returns:
        an empty PagedList object
      • getStartIndex

        public int getStartIndex()
        Returns:
        the start index (for paginator) or known as low index
      • getEndIndex

        public int getEndIndex()
        Returns:
        the end index (for paginator) or known as high index
      • getSize

        public int getSize()
        Returns:
        the size of the full list, this can be the result of EntityListIterator.getResultsSizeAfterPartialList()
      • getData

        public java.util.List<E> getData()
        Returns:
        the paged data. Eg - the result from EntityListIterator.getPartialList()
      • getViewIndex

        public int getViewIndex()
        Returns:
        the view index supplied by client
      • getViewSize

        public int getViewSize()
        Returns:
        the view size supplied by client
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<E>
        Returns:
        an interator object over the data returned in getData() method of this class