org.apache.jackrabbit.core
Class LazyItemIterator

java.lang.Object
  extended by 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 the Items only when they are requested.

Important: Items 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?

See Also:
getSize()

Constructor Summary
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.
 
Method Summary
 long getPosition()
          
 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.

 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
 

Constructor Detail

LazyItemIterator

public LazyItemIterator(SessionContext sessionContext,
                        List<? extends ItemId> idList)
Creates a new LazyItemIterator instance.

Parameters:
sessionContext - session context
idList - list of item id's

LazyItemIterator

public LazyItemIterator(SessionContext sessionContext,
                        List<? extends ItemId> idList,
                        NodeId parentId)
Creates a new LazyItemIterator instance, additionally taking a parent id as parameter. This version should be invoked to strictly return children nodes of a node.

Parameters:
sessionContext - session context
idList - list of item id's
parentId - parent id.
Method Detail

nextNode

public Node nextNode()

Specified by:
nextNode in interface NodeIterator

nextProperty

public Property nextProperty()

Specified by:
nextProperty in interface PropertyIterator

getPosition

public long getPosition()

Specified by:
getPosition in interface RangeIterator

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 interface RangeIterator

skip

public void skip(long skipNum)

Specified by:
skip in interface RangeIterator

hasNext

public boolean hasNext()

Specified by:
hasNext in interface Iterator

next

public Object next()

Specified by:
next in interface Iterator

remove

public void remove()

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - always since not implemented


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.