Package org.apache.jackrabbit.core
Class LazyItemIterator
- java.lang.Object
-
- org.apache.jackrabbit.core.LazyItemIterator
-
- All Implemented Interfaces:
Iterator
,NodeIterator
,PropertyIterator
,RangeIterator
public class LazyItemIterator extends Object implements NodeIterator, PropertyIterator
LazyItemIterator
is an id-based iterator that instantiates theItem
s only when they are requested.Important:
Item
s that appear to be nonexistent for some reason (e.g. because of insufficient access rights or because they have been removed since the iterator has been retrieved) are silently skipped. As a result the size of the iterator as reported bygetSize()
might appear to be shrinking while iterating over the items. todo should getSize() better always return -1?- See Also:
getSize()
-
-
Constructor Summary
Constructors Constructor Description LazyItemIterator(SessionContext sessionContext, List<? extends ItemId> idList)
Creates a newLazyItemIterator
instance.LazyItemIterator(SessionContext sessionContext, List<? extends ItemId> idList, NodeId parentId)
Creates a newLazyItemIterator
instance, additionally taking a parent id as parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getPosition()
long
getSize()
boolean
hasNext()
Object
next()
Node
nextNode()
Property
nextProperty()
void
remove()
void
skip(long skipNum)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
LazyItemIterator
public LazyItemIterator(SessionContext sessionContext, List<? extends ItemId> idList)
Creates a newLazyItemIterator
instance.- Parameters:
sessionContext
- session contextidList
- list of item id's
-
LazyItemIterator
public LazyItemIterator(SessionContext sessionContext, List<? extends ItemId> idList, NodeId parentId)
Creates a newLazyItemIterator
instance, additionally taking a parent id as parameter. This version should be invoked to strictly return children nodes of a node.- Parameters:
sessionContext
- session contextidList
- list of item id'sparentId
- parent id.
-
-
Method Detail
-
nextNode
public Node nextNode()
- Specified by:
nextNode
in interfaceNodeIterator
-
nextProperty
public Property nextProperty()
- Specified by:
nextProperty
in interfacePropertyIterator
-
getPosition
public long getPosition()
- Specified by:
getPosition
in interfaceRangeIterator
-
getSize
public long getSize()
Note that the size of the iterator as reported by
getSize()
might appear to be shrinking while iterating because items that for some reason cannot be retrieved through this iterator are silently skipped, thus reducing the size of this iterator. todo better to always return -1?- Specified by:
getSize
in interfaceRangeIterator
-
skip
public void skip(long skipNum)
- Specified by:
skip
in interfaceRangeIterator
-
remove
public void remove()
- Specified by:
remove
in interfaceIterator
- Throws:
UnsupportedOperationException
- always since not implemented
-
-