com.atlassian.user.search.page
Class DefaultPager<T>

java.lang.Object
  extended by com.atlassian.user.search.page.DefaultPager<T>
All Implemented Interfaces:
Pager<T>, Iterable<T>

public class DefaultPager<T>
extends Object
implements Pager<T>


Field Summary
 
Fields inherited from interface com.atlassian.user.search.page.Pager
EMPTY_PAGER, NO_POSITION, PRELOAD_LIMIT
 
Constructor Summary
DefaultPager()
          Deprecated. since 2.0.3. Use the generic-friendly emptyPager() method
DefaultPager(Collection<T> col)
           
 
Method Summary
static
<T> DefaultPager<T>
emptyPager()
           
 List<T> getCurrentPage()
           
 int getIndex()
           
 int getIndexOfFirstItemInCurrentPage()
          This pager always has all its items in a single page
 boolean hasNext()
           
 boolean isEmpty()
           
 Iterator<T> iterator()
          Use this if you want a typical iterator over the entire data.
 T next()
           
 void nextPage()
           
 boolean onLastPage()
           
 void remove()
           
 void skipTo(int index)
          Will run the index up to this point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPager

public DefaultPager()
Deprecated. since 2.0.3. Use the generic-friendly emptyPager() method


DefaultPager

public DefaultPager(Collection<T> col)
Method Detail

emptyPager

public static <T> DefaultPager<T> emptyPager()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Pager<T>

iterator

public Iterator<T> iterator()
Description copied from interface: Pager
Use this if you want a typical iterator over the entire data.

Specified by:
iterator in interface Pager<T>
Specified by:
iterator in interface Iterable<T>
Returns:
an Iterator for the entire result set.

getCurrentPage

public List<T> getCurrentPage()
Specified by:
getCurrentPage in interface Pager<T>
Returns:
a single, preloaded page.

nextPage

public void nextPage()
Specified by:
nextPage in interface Pager<T>

onLastPage

public boolean onLastPage()
Specified by:
onLastPage in interface Pager<T>

skipTo

public void skipTo(int index)
            throws PagerException
Description copied from interface: Pager
Will run the index up to this point. Calling Pager.getCurrentPage() will then return a page holding this index.

Specified by:
skipTo in interface Pager<T>
Parameters:
index - the zero-based index of the item to skip to.
Throws:
PagerException - - if the number of items in the backing data is exceeded by the index.

getIndex

public int getIndex()
Specified by:
getIndex in interface Pager<T>
Returns:
the current index position of the pager

getIndexOfFirstItemInCurrentPage

public int getIndexOfFirstItemInCurrentPage()
This pager always has all its items in a single page

Specified by:
getIndexOfFirstItemInCurrentPage in interface Pager<T>
Returns:
zero, because this pager has all its items in a single page

remove

public void remove()

hasNext

public boolean hasNext()

next

public T next()


Copyright © 2005-2009 Atlassian Software Systems Pty Ltd. All Rights Reserved.