T - The type of object handled by this class.@ThreadSafety(level=NOT_THREADSAFE) public final class PersistedObjects<T> extends java.lang.Object implements java.io.Serializable, java.io.Closeable
search methods in
the LDAPPersister class. However, it has a couple of notable
differences from a standard Java Iterator object:
hasNext method. Instead, the next()
method will return null when there are no more objects in the
set of results.next() method may throw an exception if a problem occurs
while trying to read an entry or decode it as an object of the
appropriate type. This does not necessarily mean that the search is
complete, and the next() method should be called again to see
if there are any more objects to retrieve.close() method
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Indicates that you wish to stop iterating through search results and will
not be retrieving any additional objects.
|
SearchResult |
getSearchResult()
Retrieves the search result for the search operation, if available.
|
T |
next()
Retrieves the next object returned from the search request.
|
@Nullable public T next() throws LDAPPersistException
null
if all objects have been read.LDAPPersistException - If a problem occurs while reading the next
entry from the server, or when trying to
decode that entry as an object.public void close()
next() method returns null to indicate that there are no
more objects to retrieve. This method MAY be called after the search has
completed (including being called multiple times) with no adverse effects.close in interface java.io.Closeableclose in interface java.lang.AutoCloseable@Nullable public SearchResult getSearchResult()
null return value from the next() method), and for some use
cases it may never be available.null if it
is not available (e.g., because the search has not yet completed).