Package org.wildfly.naming.client
Interface CloseableNamingEnumeration<T>
-
- All Superinterfaces:
AutoCloseable,Enumeration<T>,NamingCloseable,NamingEnumeration<T>
public interface CloseableNamingEnumeration<T> extends NamingEnumeration<T>, NamingCloseable
A naming enumeration which works withtry-with-resources.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description static CloseableNamingEnumeration<?>EMPTY-
Fields inherited from interface org.wildfly.naming.client.NamingCloseable
NULL
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Close the enumeration.static <T> CloseableNamingEnumeration<T>empty()static <T> CloseableNamingEnumeration<T>fromEnumeration(Enumeration<T> enumeration)Create a naming enumeration from a collection enumeration.static <T> CloseableNamingEnumeration<T>fromEnumeration(NamingEnumeration<T> enumeration)Create a closeable naming enumeration from a naming enumeration.static <T> CloseableNamingEnumeration<T>fromIterable(Iterable<T> iterable)Create a naming enumeration from an iterable collection.static <T> CloseableNamingEnumeration<T>fromIterator(Iterator<T> iterator)Create a naming enumeration from a collection iterator.-
Methods inherited from interface java.util.Enumeration
asIterator, hasMoreElements, nextElement
-
Methods inherited from interface javax.naming.NamingEnumeration
hasMore, next
-
-
-
-
Field Detail
-
EMPTY
static final CloseableNamingEnumeration<?> EMPTY
-
-
Method Detail
-
close
void close() throws NamingExceptionClose the enumeration.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceNamingCloseable- Specified by:
closein interfaceNamingEnumeration<T>- Throws:
NamingException- if closing the enumeration failed for some reason
-
fromIterable
static <T> CloseableNamingEnumeration<T> fromIterable(Iterable<T> iterable)
Create a naming enumeration from an iterable collection.- Type Parameters:
T- the element type- Parameters:
iterable- the iterable- Returns:
- the enumeration
-
fromIterator
static <T> CloseableNamingEnumeration<T> fromIterator(Iterator<T> iterator)
Create a naming enumeration from a collection iterator.- Type Parameters:
T- the element type- Parameters:
iterator- the iterator- Returns:
- the enumeration
-
fromEnumeration
static <T> CloseableNamingEnumeration<T> fromEnumeration(Enumeration<T> enumeration)
Create a naming enumeration from a collection enumeration.- Type Parameters:
T- the element type- Parameters:
enumeration- the enumeration- Returns:
- the enumeration
-
fromEnumeration
static <T> CloseableNamingEnumeration<T> fromEnumeration(NamingEnumeration<T> enumeration)
Create a closeable naming enumeration from a naming enumeration.- Type Parameters:
T- the element type- Parameters:
enumeration- the enumeration- Returns:
- the enumeration
-
empty
static <T> CloseableNamingEnumeration<T> empty()
-
-