class MongoBatchCursorAdapter<T> extends java.lang.Object implements MongoCursor<T>
| Modifier and Type | Field and Description |
|---|---|
private BatchCursor<T> |
batchCursor |
private java.util.List<T> |
curBatch |
private int |
curPos |
| Constructor and Description |
|---|
MongoBatchCursorAdapter(BatchCursor<T> batchCursor) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
private T |
getNextInBatch() |
ServerAddress |
getServerAddress()
Returns the server address
|
ServerCursor |
getServerCursor()
Returns the server cursor, which can be null if the no cursor was created or if the cursor has been exhausted or killed.
|
boolean |
hasNext() |
T |
next() |
void |
remove() |
T |
tryNext()
A special
next() case that returns the next element in the iteration if available or null. |
private final BatchCursor<T> batchCursor
private java.util.List<T> curBatch
private int curPos
public MongoBatchCursorAdapter(BatchCursor<T> batchCursor)
public void remove()
remove in interface java.util.Iterator<T>public void close()
close in interface MongoCursor<T>close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic boolean hasNext()
hasNext in interface MongoCursor<T>hasNext in interface java.util.Iterator<T>public T next()
next in interface MongoCursor<T>next in interface java.util.Iterator<T>public T tryNext()
MongoCursornext() case that returns the next element in the iteration if available or null.
Tailable cursors are an example where this is useful. A call to tryNext() may return null, but in the future calling
tryNext() would return a new element if a document had been added to the capped collection.
tryNext in interface MongoCursor<T>public ServerCursor getServerCursor()
MongoCursorgetServerCursor in interface MongoCursor<T>public ServerAddress getServerAddress()
MongoCursorgetServerAddress in interface MongoCursor<T>private T getNextInBatch()