Interface FindPublisherPreparer
- All Superinterfaces:
ReadPreferenceAware
Simple callback interface to allow customization of a
FindPublisher.- Author:
- Mark Paluch, Christoph Strobl, Konstantin Volivach
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FindPublisherPreparerDefaultFindPublisherPreparerjust passing on the givenFindPublisher. -
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable ReadPreferencedefault FindPublisher<Document> initiateFind(MongoCollection<Document> collection, Function<MongoCollection<Document>, FindPublisher<Document>> find) Apply query specific settings toMongoCollectionand initiate a find operation returning aFindPublishervia the givenfindfunction.prepare(FindPublisher<Document> findPublisher) Prepare the given cursor (apply limits, skips and so on).Methods inherited from interface ReadPreferenceAware
hasReadPreference
-
Field Details
-
NO_OP_PREPARER
DefaultFindPublisherPreparerjust passing on the givenFindPublisher.- Since:
- 2.2
-
-
Method Details
-
prepare
Prepare the given cursor (apply limits, skips and so on). Returns the prepared cursor.- Parameters:
findPublisher- must not be null.
-
initiateFind
default FindPublisher<Document> initiateFind(MongoCollection<Document> collection, Function<MongoCollection<Document>, FindPublisher<Document>> find) Apply query specific settings toMongoCollectionand initiate a find operation returning aFindPublishervia the givenfindfunction.- Parameters:
collection- must not be null.find- must not be null.- Returns:
- never null.
- Throws:
IllegalArgumentException- if one of the required arguments is null.- Since:
- 2.2
-
getReadPreference
- Specified by:
getReadPreferencein interfaceReadPreferenceAware- Returns:
- the
ReadPreferenceto apply or null if none defined. - Since:
- 2.2
-