Clearspace API (1.7.0) Core Javadocs

com.jivesoftware.community
Interface JiveIterator<T extends JiveObject>

All Superinterfaces:
java.lang.Iterable<T>, java.util.Iterator<T>

public interface JiveIterator<T extends JiveObject>
extends java.util.Iterator<T>, java.lang.Iterable<T>

An extension of the Iterator class which allows backwards and forwards iteration, looking up of the ID of next element as well as setting an index into the iteration.


Method Summary
 boolean hasNext()
          Returns true if this iterator has more elements when traversing the list in the forward direction.
 boolean hasPrevious()
          Returns true if this list iterator has more elements when traversing the list in the reverse direction.
 T next()
          Returns the next element in the list.
 long nextID()
          Returns the ID of the next element in the iteration.
 T previous()
          Returns the previous element in the list.
 void remove()
          This method of the Iterator interface is not supported due to security considerations.
 void setIndex(long objectID)
          Sets the index for the iteration to the specified object ID.
 void skipElement()
          Skip over an element in the iteration.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

hasNext

boolean hasNext()
Returns true if this iterator has more elements when traversing the list in the forward direction. (In other words, returns true if next would return a an object rather than throwing an exception.)

Specified by:
hasNext in interface java.util.Iterator<T extends JiveObject>
Returns:
true if the iterator has more elements when traversing the list in the forward direction.

nextID

long nextID()
Returns the ID of the next element in the iteration. This method is designed to be used internally by Jive's permission system for checking the permissions on an object without actually loading the object. In doing this performance is enhanced, sometimes significantly, by eliminating database calls that would otherwise be required to load the object.

Current implementation allows for bypassing the object load before checking permissions for some objects such as documents. Other objects such as communities will be loaded prior to permission checking.

External usage of this method is strongly discouraged.

Returns:
the ID of the next element in the iteration.
Throws:
java.util.NoSuchElementException - iteration has no more elements.

next

T next()
Returns the next element in the list. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Specified by:
next in interface java.util.Iterator<T extends JiveObject>
Returns:
the next element in the list.
Throws:
java.util.NoSuchElementException - if the iteration has no next element.

skipElement

void skipElement()
Skip over an element in the iteration. This method is designed to be used internally by Jive's permission system to skip an element in an iteration when permissions state that the user is not allowed access to the element.

External usage of this method is strongly discouraged.


hasPrevious

boolean hasPrevious()
Returns true if this list iterator has more elements when traversing the list in the reverse direction. (In other words, returns true if previous would return an object rather than throwing an exception.)

Returns:
true if the list iterator has more elements when traversing the list in the reverse direction.

previous

T previous()
Returns the previous element in the list. This method may be called repeatedly to iterate t hrough the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Returns:
the previous element in the list.
Throws:
java.util.NoSuchElementException - if the iteration has no previous element.

setIndex

void setIndex(long objectID)
Sets the index for the iteration to the specified object ID.

Implementation note: a performance setting allows an optional short-term query cache so that object invalidations are delayed for a period of time. This can mean that trying to set the index for a newly created message can fail. Ensure that this performance setting is disabled, or refrain from calling this method with newly created messages.

Parameters:
objectID - the id of the object to set the interation index to.
Throws:
java.util.NoSuchElementException - if objectID is not a valid element of the iteration.

remove

void remove()
This method of the Iterator interface is not supported due to security considerations. Calling it will always result in an an exception being thrown.

Specified by:
remove in interface java.util.Iterator<T extends JiveObject>
Throws:
java.lang.UnsupportedOperationException - if this method is called.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.