final class ChangeStreamBatchCursor<T> extends java.lang.Object implements BatchCursor<T>
| Modifier and Type | Field and Description |
|---|---|
private ReadBinding |
binding |
private ChangeStreamOperation<T> |
changeStreamOperation |
private BsonDocument |
resumeToken |
private BatchCursor<RawBsonDocument> |
wrapped |
| Constructor and Description |
|---|
ChangeStreamBatchCursor(ChangeStreamOperation<T> changeStreamOperation,
BatchCursor<RawBsonDocument> wrapped,
ReadBinding binding) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
private java.util.List<T> |
convertResults(java.util.List<RawBsonDocument> rawDocuments) |
int |
getBatchSize()
Gets the batch size to use when requesting the next batch.
|
ServerAddress |
getServerAddress()
Returns the server address
|
ServerCursor |
getServerCursor()
Returns the server cursor
|
(package private) BatchCursor<RawBsonDocument> |
getWrapped() |
boolean |
hasNext()
Returns true if another batch of results exists.
|
java.util.List<T> |
next()
Returns the next batch of results.
|
void |
remove() |
(package private) <R> R |
resumeableOperation(Function<BatchCursor<RawBsonDocument>,R> function) |
void |
setBatchSize(int batchSize)
Sets the batch size to use when requesting the next batch.
|
java.util.List<T> |
tryNext()
A special
next() case that returns the next batch if available or null. |
private final ReadBinding binding
private final ChangeStreamOperation<T> changeStreamOperation
private BsonDocument resumeToken
private BatchCursor<RawBsonDocument> wrapped
ChangeStreamBatchCursor(ChangeStreamOperation<T> changeStreamOperation, BatchCursor<RawBsonDocument> wrapped, ReadBinding binding)
BatchCursor<RawBsonDocument> getWrapped()
public boolean hasNext()
BatchCursorhasNext in interface BatchCursor<T>hasNext in interface java.util.Iterator<java.util.List<T>>public java.util.List<T> next()
BatchCursornext in interface BatchCursor<T>next in interface java.util.Iterator<java.util.List<T>>public java.util.List<T> tryNext()
BatchCursornext() case that returns the next batch 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 batch if a document had been added to the capped collection.
tryNext in interface BatchCursor<T>public void close()
close in interface BatchCursor<T>close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void setBatchSize(int batchSize)
BatchCursorsetBatchSize in interface BatchCursor<T>batchSize - the non-negative batch size. 0 means to use the server default.public int getBatchSize()
BatchCursorgetBatchSize in interface BatchCursor<T>public ServerCursor getServerCursor()
BatchCursorgetServerCursor in interface BatchCursor<T>public ServerAddress getServerAddress()
BatchCursorgetServerAddress in interface BatchCursor<T>public void remove()
remove in interface java.util.Iterator<java.util.List<T>>private java.util.List<T> convertResults(java.util.List<RawBsonDocument> rawDocuments)
<R> R resumeableOperation(Function<BatchCursor<RawBsonDocument>,R> function)