abstract class MongoIterableImpl<TResult> extends java.lang.Object implements MongoIterable<TResult>
Modifier and Type | Field and Description |
---|---|
private java.lang.Integer |
batchSize |
private ClientSession |
clientSession |
private AsyncOperationExecutor |
executor |
private ReadConcern |
readConcern |
private ReadPreference |
readPreference |
Constructor and Description |
---|
MongoIterableImpl(ClientSession clientSession,
AsyncOperationExecutor executor,
ReadConcern readConcern,
ReadPreference readPreference) |
Modifier and Type | Method and Description |
---|---|
(package private) abstract AsyncReadOperation<AsyncBatchCursor<TResult>> |
asAsyncReadOperation() |
void |
batchCursor(SingleResultCallback<AsyncBatchCursor<TResult>> callback)
Provide the underlying
AsyncBatchCursor allowing fine grained control of the cursor. |
MongoIterable<TResult> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
void |
first(SingleResultCallback<TResult> callback)
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super TResult> block,
SingleResultCallback<java.lang.Void> callback)
Iterates over all documents in the view, applying the given block to each, and completing the returned future after all documents
have been iterated, or an exception has occurred.
|
java.lang.Integer |
getBatchSize() |
ClientSession |
getClientSession() |
(package private) AsyncOperationExecutor |
getExecutor() |
(package private) ReadConcern |
getReadConcern() |
(package private) ReadPreference |
getReadPreference() |
<A extends java.util.Collection<? super TResult>> |
into(A target,
SingleResultCallback<A> callback)
Iterates over all the documents, adding each to the given target.
|
private void |
loopCursor(AsyncBatchCursor<TResult> batchCursor,
Block<? super TResult> block,
SingleResultCallback<java.lang.Void> callback) |
<U> MongoIterable<U> |
map(Function<TResult,U> mapper)
Maps this iterable from the source document type to the target document type.
|
(package private) <T> BsonDocument |
toBsonDocumentOrNull(Bson document,
java.lang.Class<T> documentClass,
CodecRegistry codecRegistry) |
(package private) BsonDocument |
toBsonDocumentOrNull(Bson document,
CodecRegistry codecRegistry) |
private final ClientSession clientSession
private final ReadConcern readConcern
private AsyncOperationExecutor executor
private ReadPreference readPreference
private java.lang.Integer batchSize
MongoIterableImpl(ClientSession clientSession, AsyncOperationExecutor executor, ReadConcern readConcern, ReadPreference readPreference)
abstract AsyncReadOperation<AsyncBatchCursor<TResult>> asAsyncReadOperation()
public ClientSession getClientSession()
AsyncOperationExecutor getExecutor()
ReadPreference getReadPreference()
ReadConcern getReadConcern()
public java.lang.Integer getBatchSize()
public void forEach(Block<? super TResult> block, SingleResultCallback<java.lang.Void> callback)
MongoIterable
forEach
in interface MongoIterable<TResult>
block
- the block to apply to each documentcallback
- a callback that completed once the iteration has completedpublic <A extends java.util.Collection<? super TResult>> void into(A target, SingleResultCallback<A> callback)
MongoIterable
into
in interface MongoIterable<TResult>
A
- the collection typetarget
- the collection to insert intocallback
- a callback that will be passed the target containing all documentspublic void first(SingleResultCallback<TResult> callback)
MongoIterable
first
in interface MongoIterable<TResult>
callback
- a callback that is passed the first item or null.public <U> MongoIterable<U> map(Function<TResult,U> mapper)
MongoIterable
map
in interface MongoIterable<TResult>
U
- the target document typemapper
- a function that maps from the source to the target document typepublic MongoIterable<TResult> batchSize(int batchSize)
MongoIterable
batchSize
in interface MongoIterable<TResult>
batchSize
- the batch sizepublic void batchCursor(SingleResultCallback<AsyncBatchCursor<TResult>> callback)
MongoIterable
AsyncBatchCursor
allowing fine grained control of the cursor.batchCursor
in interface MongoIterable<TResult>
callback
- a callback that will be passed the AsyncBatchCursorBsonDocument toBsonDocumentOrNull(Bson document, CodecRegistry codecRegistry)
<T> BsonDocument toBsonDocumentOrNull(Bson document, java.lang.Class<T> documentClass, CodecRegistry codecRegistry)
private void loopCursor(AsyncBatchCursor<TResult> batchCursor, Block<? super TResult> block, SingleResultCallback<java.lang.Void> callback)