Jive Forums API (5.5.20.2-oracle) Core Javadocs

com.jivesoftware.forum
Class ForumMessageIterator

java.lang.Object
  extended by com.jivesoftware.forum.ForumMessageIterator
All Implemented Interfaces:
java.util.Iterator

public abstract class ForumMessageIterator
extends java.lang.Object
implements java.util.Iterator

An iterator for ForumMessages that allows backwards and forwards iteration, as well as setting an index into the Iteration.


Field Summary
static ForumMessageIterator EMPTY_ITERATOR
          The empty message iterator.
 
Constructor Summary
ForumMessageIterator()
           
 
Method Summary
abstract  boolean hasNext()
          Returns true if this iterator has more messages when traversing the list in the forward direction.
abstract  boolean hasPrevious()
          Returns true if this list iterator has more messages when traversing the list in the reverse direction.
abstract  java.lang.Object next()
          Returns the next message in the list.
abstract  java.lang.Object previous()
          Returns the previous element in the list.
 void remove()
          This method of the Iterator interface is not supported due to security considerations.
abstract  void setIndex(long messageID)
          Sets the index for the iteration to the specified message ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ITERATOR

public static final ForumMessageIterator EMPTY_ITERATOR
The empty message iterator.

Constructor Detail

ForumMessageIterator

public ForumMessageIterator()
Method Detail

hasNext

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

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more messages when traversing the list in the forward direction.

next

public abstract java.lang.Object next()
Returns the next message 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
Returns:
the next thread in the list.
Throws:
java.util.NoSuchElementException - if the iteration has no next element.

hasPrevious

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

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

previous

public abstract java.lang.Object previous()
Returns the previous element in the list. This method may be called repeatedly to iterate through 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

public abstract void setIndex(long messageID)
Sets the index for the iteration to the specified message 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.

Throws:
java.util.NoSuchElementException - if messageID is not a valid element of the iteration.

remove

public 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
Throws:
java.lang.UnsupportedOperationException - if this method is called.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.