org.opencms.cmis
Class CmsObjectListLimiter<A>

java.lang.Object
  extended by org.opencms.cmis.CmsObjectListLimiter<A>
Type Parameters:
A - the content type of the list
All Implemented Interfaces:
java.lang.Iterable<A>, java.util.Iterator<A>

public class CmsObjectListLimiter<A>
extends java.lang.Object
implements java.lang.Iterable<A>, java.util.Iterator<A>

Helper class to ease implementation of CMIS service methods which support paging.

This class works as an iterator for a given list, and limits the number of iterations based on skip/max parameters which are usually passed to the service methods.


Constructor Summary
CmsObjectListLimiter(java.util.List<A> baseList, java.math.BigInteger maxItems, java.math.BigInteger skipCount)
          Creates a new instance.
 
Method Summary
 boolean hasMore()
          Checks if there are more items left in the base list which were not returned.
 boolean hasNext()
           
 java.util.Iterator<A> iterator()
           
 A next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsObjectListLimiter

public CmsObjectListLimiter(java.util.List<A> baseList,
                            java.math.BigInteger maxItems,
                            java.math.BigInteger skipCount)
Creates a new instance.

Parameters:
baseList - the list over which we want to iterate
maxItems - the maximum number of items
skipCount - the number of items to skip
Method Detail

hasMore

public boolean hasMore()
Checks if there are more items left in the base list which were not returned.

Returns:
true if there are more items left in the base list which were not returned

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<A>
See Also:
Iterator.hasNext()

iterator

public java.util.Iterator<A> iterator()
Specified by:
iterator in interface java.lang.Iterable<A>
See Also:
Iterable.iterator()

next

public A next()
Specified by:
next in interface java.util.Iterator<A>
See Also:
Iterator.next()

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<A>
See Also:
Iterator.remove()