public class LazyItemIterator extends Object implements javax.jcr.NodeIterator, javax.jcr.PropertyIterator, javax.jcr.version.VersionIterator
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()
always returns -1.
Type | Property and Description |
---|---|
javax.jcr.Property |
next |
Constructor and Description |
---|
LazyItemIterator(ItemManager itemMgr,
HierarchyManager hierarchyMgr,
Iterator<? extends ItemId> itemIds)
Creates a new
LazyItemIterator instance. |
LazyItemIterator(ItemManager itemMgr,
Iterator<? extends HierarchyEntry> hierarchyEntryIterator)
Creates a new
LazyItemIterator instance. |
Modifier and Type | Method and Description |
---|---|
long |
getPosition() |
long |
getSize()
Returns the number of
Item s in this iterator or -1 if the
size is unknown. |
boolean |
hasNext() |
Object |
next() |
javax.jcr.Node |
nextNode() |
javax.jcr.Property |
nextProperty() |
javax.jcr.version.Version |
nextVersion() |
void |
remove() |
void |
skip(long skipNum) |
nextProperty
in interface javax.jcr.PropertyIterator
PropertyIterator.nextProperty()
public LazyItemIterator(ItemManager itemMgr, Iterator<? extends HierarchyEntry> hierarchyEntryIterator)
LazyItemIterator
instance.itemMgr
- item managerhierarchyEntryIterator
- Iterator over HierarchyEntriespublic LazyItemIterator(ItemManager itemMgr, HierarchyManager hierarchyMgr, Iterator<? extends ItemId> itemIds) throws javax.jcr.ItemNotFoundException, javax.jcr.RepositoryException
LazyItemIterator
instance.itemMgr
- hierarchyMgr
- itemIds
- javax.jcr.ItemNotFoundException
javax.jcr.RepositoryException
public javax.jcr.Node nextNode()
nextNode
in interface javax.jcr.NodeIterator
NodeIterator.nextNode()
public javax.jcr.Property nextProperty()
nextProperty
in interface javax.jcr.PropertyIterator
PropertyIterator.nextProperty()
public javax.jcr.version.Version nextVersion()
nextVersion
in interface javax.jcr.version.VersionIterator
VersionIterator.nextVersion()
public long getPosition()
getPosition
in interface javax.jcr.RangeIterator
RangeIterator.getPosition()
public long getSize()
Item
s in this iterator or -1 if the
size is unknown.
Note: The number returned by this method may differ from the number
of Item
s actually returned by calls to hasNext() / getNextNode().
This is caused by the lazy instantiation behaviour of this iterator,
that may detect only upon iteration that an Item has been invalidated
or removed in the mean time. As soon as an invalid Item
is
detected, the size of this iterator is adjusted.
getSize
in interface javax.jcr.RangeIterator
Item
s in this iterator.RangeIterator.getSize()
public void skip(long skipNum)
skip
in interface javax.jcr.RangeIterator
RangeIterator.skip(long)
public boolean hasNext()
hasNext
in interface Iterator
Iterator.hasNext()
public Object next()
next
in interface Iterator
Iterator.next()
public void remove()
remove
in interface Iterator
UnsupportedOperationException
- always since removal is not implemented.Iterator.remove()
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.