javax.naming

Interface NamingEnumeration<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 {@link #next()} and {@link #hasMore()}. If the inherited {@link java.util.Enumeration#nextElement()} and {@link 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
voidclose()
Immediately frees all resources, owned by this enumeration.
booleanhasMore()
Checks if there are more unvisited elements in the enumeration, throwing exceptions if there are some unvisited, but not available elements.
Tnext()
Returns the next element in this enumeration.

Method Detail

close

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

Throws: NamingException

hasMore

public boolean hasMore()
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 {@link 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

next

public T next()
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