javax.naming
Interface NamingEnumeration<T>

All Superinterfaces:
Enumeration<T>

public interface NamingEnumeration<T>
extends Enumeration<T>

The specific type of enumeration that supports throwing various exceptions by the hasMore method. The exceptions are only thrown if the enumeration is scanned using next() and hasMore(). If the inherited Enumeration.nextElement() and Enumeration.hasMoreElements() are used instead, the exceptions are not throwed, and the enumeration is just iterated over available elements.

This enumeration becomes invalid after throwing the exception. If the exception has been thrown, not other method should be called of that enumeration.


Method Summary
 void close()
          Immediately frees all resources, owned by this enumeration.
 boolean hasMore()
          Checks if there are more unvisited elements in the enumeration, throwing exceptions if there are some unvisited, but not available elements.
 T next()
          Returns the next element in this enumeration.
 
Methods inherited from interface java.util.Enumeration
hasMoreElements, nextElement
 

Method Detail

next

T next()
       throws NamingException
Returns the next element in this enumeration. The naming - specific exceptions are only throws after returning all still available elements of the enumeration.

Returns:
the next element of this enumeration
Throws:
NamingException

hasMore

boolean hasMore()
                throws NamingException
Checks if there are more unvisited elements in the enumeration, throwing exceptions if there are some unvisited, but not available elements.

Returns:
true if there are some unvisited elements, false otherwise.
Throws:
PartialResultException - if the enumeration, returned by the Context.list(Name) or other similar method contains only partial answer.
SizeLimitExceededException - if remaining elements are not available because of the previously specified size limit.
NamingException

close

void close()
           throws NamingException
Immediately frees all resources, owned by this enumeration. If invoked, it must be the last method called for that enumeration.

Throws:
NamingException