|
Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class is for iterating UDDI elements (of the same type) in various UddiElements.
It is very similar to java.util.Iterator. However, it allows exceptions to be thrown during the iteration. The methodshasNextUddiElement()
and nextUddiElement()
are named so to avoid name collision with Iterator
, in
case an implementation chooses to implement both.
Note also that NoSuchElementException is thrown if the program invokes next() when there are no elements left in the iterator. The program can always avoid this exception by using hasMore() to check whether the end of the iteration has been reached.
If an exception is thrown during an iteration, the iterator becomes invalid. Subsequent invocation of any method on that iterator will yield undefined results.
Method Summary |
Type | Method |
---|---|
void |
close()
Closes this iteration. |
IteratorElementLifeCycle |
getElementLifeCycle()
Is the element returned in next() call reused in the subsequenet next() calls. |
boolean |
hasNextUddiElement()
Determines whether there are any more elements in the iteration. |
UddiElement |
nextUddiElement()
Retrieves the next element in the iteration. |
Method Detail |
public IteratorElementLifeCycle getElementLifeCycle()
IteratorElementLifeCycle
public boolean hasNextUddiElement() throws UddiException
Iterator.hasNext()
public UddiElement nextUddiElement() throws UddiException
Retrieves the next element in the iteration. This method allows iterator exceptions encountered while retrieving the next element to be caught and handled by the application.
Note that next() can also throw the runtime exception NoSuchElementException to indicate that the caller is attempting to enumerate beyond the end of the iteration. This is different from a UddiException, which indicates that there was a problem in obtaining the next element.
Iterator.next()
public void close() throws UddiException
Closes this iteration. After this method has been invoked on this iteration, the iteration becomes invalid and subsequent invocation of any of its methods will yield undefined results. This method is intended for freeing up resources used by the iteration. The client should always call close() when his operation on the iteration is finished.
If the caller has exhausted the iterator, i.e., hasNextUddiElement() return false, the caller does not have to make the close() call: the iterator will implicitly make the close() call when the iterator is exhausted. However, if the caller does explicitly make the close() call, the iterator should not throw any exception either.
This method indicates to the service provider that it is free to release resources associated with the iteration, and can notify servers to cancel any outstanding requests. The close() method is a hint to implementations for managing their resources. Implementations are encouraged to use appropriate algorithms to manage their resources when client accidentally omits the close() calls.
|
Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |