Interface CursorPreparer
- All Superinterfaces:
ReadPreferenceAware
Simple callback interface to allow customization of a
FindIterable.- Author:
- Oliver Gierke, Christoph Strobl
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CursorPreparerDefaultCursorPreparerjust passing on the givenFindIterable. -
Method Summary
Modifier and TypeMethodDescriptiondefault ReadPreferencedefault FindIterable<Document>initiateFind(MongoCollection<Document> collection, Function<MongoCollection<Document>, FindIterable<Document>> find) Apply query specific settings toMongoCollectionand initiate a find operation returning aFindIterablevia the givenfindfunction.prepare(FindIterable<Document> iterable) Prepare the given cursor (apply limits, skips and so on).Methods inherited from interface org.springframework.data.mongodb.core.ReadPreferenceAware
hasReadPreference
-
Field Details
-
NO_OP_PREPARER
DefaultCursorPreparerjust passing on the givenFindIterable.- Since:
- 2.2
-
-
Method Details
-
prepare
Prepare the given cursor (apply limits, skips and so on). Returns the prepared cursor.- Parameters:
iterable- must not be null.- Returns:
- never null.
-
initiateFind
default FindIterable<Document> initiateFind(MongoCollection<Document> collection, Function<MongoCollection<Document>, FindIterable<Document>> find) Apply query specific settings toMongoCollectionand initiate a find operation returning aFindIterablevia 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
-