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 OperationExecutor |
executor |
private ReadConcern |
readConcern |
private ReadPreference |
readPreference |
Constructor and Description |
---|
MongoIterableImpl(ClientSession clientSession,
OperationExecutor executor,
ReadConcern readConcern,
ReadPreference readPreference) |
Modifier and Type | Method and Description |
---|---|
(package private) abstract ReadOperation<BatchCursor<TResult>> |
asReadOperation() |
MongoIterable<TResult> |
batchSize(int batchSize)
Sets the number of documents to return per batch.
|
private BatchCursor<TResult> |
execute() |
TResult |
first()
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super TResult> block)
Iterates over all documents in the view, applying the given block to each.
|
java.lang.Integer |
getBatchSize() |
(package private) ClientSession |
getClientSession() |
(package private) OperationExecutor |
getExecutor() |
(package private) ReadConcern |
getReadConcern() |
(package private) ReadPreference |
getReadPreference() |
<A extends java.util.Collection<? super TResult>> |
into(A target)
Iterates over all the documents, adding each to the given target.
|
MongoCursor<TResult> |
iterator() |
<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 OperationExecutor executor
private ReadPreference readPreference
private java.lang.Integer batchSize
MongoIterableImpl(ClientSession clientSession, OperationExecutor executor, ReadConcern readConcern, ReadPreference readPreference)
abstract ReadOperation<BatchCursor<TResult>> asReadOperation()
ClientSession getClientSession()
OperationExecutor getExecutor()
ReadPreference getReadPreference()
ReadConcern getReadConcern()
public java.lang.Integer getBatchSize()
public MongoIterable<TResult> batchSize(int batchSize)
MongoIterable
batchSize
in interface MongoIterable<TResult>
batchSize
- the batch sizepublic MongoCursor<TResult> iterator()
iterator
in interface MongoIterable<TResult>
iterator
in interface java.lang.Iterable<TResult>
public TResult first()
MongoIterable
first
in interface MongoIterable<TResult>
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 void forEach(Block<? super TResult> block)
MongoIterable
Similar to map
but the function is fully encapsulated with no returned result.
forEach
in interface MongoIterable<TResult>
block
- the block to apply to each document of type T.public <A extends java.util.Collection<? super TResult>> A into(A target)
MongoIterable
into
in interface MongoIterable<TResult>
A
- the collection typetarget
- the collection to insert intoBsonDocument toBsonDocumentOrNull(Bson document, CodecRegistry codecRegistry)
<T> BsonDocument toBsonDocumentOrNull(Bson document, java.lang.Class<T> documentClass, CodecRegistry codecRegistry)
private BatchCursor<TResult> execute()