public class LazyItemIterator extends Object implements NodeIterator, PropertyIterator
LazyItemIterator
is an id-based iterator that instantiates
the Item
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 by
getSize()
might appear to be shrinking while iterating over the
items.
todo should getSize() better always return -1?
getSize()
Constructor and Description |
---|
LazyItemIterator(SessionContext sessionContext,
List<? extends ItemId> idList)
Creates a new
LazyItemIterator instance. |
LazyItemIterator(SessionContext sessionContext,
List<? extends ItemId> idList,
NodeId parentId)
Creates a new
LazyItemIterator instance, additionally taking
a parent id as parameter. |
Modifier and Type | Method and Description |
---|---|
long |
getPosition() |
long |
getSize() |
boolean |
hasNext() |
Object |
next() |
Node |
nextNode() |
Property |
nextProperty() |
void |
remove() |
void |
skip(long skipNum) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public LazyItemIterator(SessionContext sessionContext, List<? extends ItemId> idList)
LazyItemIterator
instance.sessionContext
- session contextidList
- list of item id'spublic LazyItemIterator(SessionContext sessionContext, List<? extends ItemId> idList, NodeId parentId)
LazyItemIterator
instance, additionally taking
a parent id as parameter. This version should be invoked to strictly return
children nodes of a node.sessionContext
- session contextidList
- list of item id'sparentId
- parent id.public Node nextNode()
nextNode
in interface NodeIterator
public Property nextProperty()
nextProperty
in interface PropertyIterator
public long getPosition()
getPosition
in interface RangeIterator
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?
getSize
in interface RangeIterator
public void skip(long skipNum)
skip
in interface RangeIterator
public void remove()
remove
in interface Iterator
UnsupportedOperationException
- always since not implementedCopyright © 2004–2022 The Apache Software Foundation. All rights reserved.