public class LazyItemIterator extends Object implements javax.jcr.NodeIterator, javax.jcr.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()
Type | Property and Description |
---|---|
javax.jcr.Property |
next |
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() |
javax.jcr.Node |
nextNode() |
javax.jcr.Property |
nextProperty() |
void |
remove() |
void |
skip(long skipNum) |
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 javax.jcr.Node nextNode()
nextNode
in interface javax.jcr.NodeIterator
public javax.jcr.Property nextProperty()
nextProperty
in interface javax.jcr.PropertyIterator
public long getPosition()
getPosition
in interface javax.jcr.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 javax.jcr.RangeIterator
public void skip(long skipNum)
skip
in interface javax.jcr.RangeIterator
public void remove()
remove
in interface Iterator
UnsupportedOperationException
- always since not implementedCopyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.