@@ -82,7 +82,7 @@ public ReactiveGridFsTemplate(ReactiveMongoDatabaseFactory dbFactory, MongoConve
8282 *
8383 * @param dbFactory must not be {@literal null}.
8484 * @param converter must not be {@literal null}.
85- * @param bucket
85+ * @param bucket can be {@literal null}.
8686 */
8787 public ReactiveGridFsTemplate (ReactiveMongoDatabaseFactory dbFactory , MongoConverter converter ,
8888 @ Nullable String bucket ) {
@@ -96,7 +96,7 @@ public ReactiveGridFsTemplate(ReactiveMongoDatabaseFactory dbFactory, MongoConve
9696 * @param dataBufferFactory must not be {@literal null}.
9797 * @param dbFactory must not be {@literal null}.
9898 * @param converter must not be {@literal null}.
99- * @param bucket
99+ * @param bucket can be {@literal null}.
100100 */
101101 public ReactiveGridFsTemplate (DataBufferFactory dataBufferFactory , ReactiveMongoDatabaseFactory dbFactory ,
102102 MongoConverter converter , @ Nullable String bucket ) {
@@ -117,6 +117,8 @@ public Mono<ObjectId> store(Publisher<DataBuffer> content, @Nullable String file
117117 return store (content , filename , contentType , toDocument (metadata ));
118118 }
119119
120+ @ Override
121+ @ SuppressWarnings ("unchecked" )
120122 public <T > Mono <T > store (GridFsObject <T , Publisher <DataBuffer >> upload ) {
121123
122124 GridFSUploadOptions uploadOptions = computeUploadOptionsFor (upload .getOptions ().getContentType (),
@@ -274,6 +276,7 @@ public FindCallback(Query query, Document queryObject, Document sortObject) {
274276 this .sortObject = sortObject ;
275277 }
276278
279+ @ Override
277280 public GridFSFindPublisher doInBucket (GridFSBucket bucket ) {
278281
279282 GridFSFindPublisher findPublisher = bucket .find (queryObject ).sort (sortObject );
@@ -311,55 +314,25 @@ public GridFSFindPublisher doInBucket(GridFSBucket bucket) {
311314 }
312315 }
313316
314- private static class UploadCallback implements ReactiveBucketCallback <Void > {
315-
316- private final BsonValue fileId ;
317- private final String filename ;
318- private final Publisher <ByteBuffer > source ;
319- private final GridFSUploadOptions uploadOptions ;
320-
321- public UploadCallback (BsonValue fileId , String filename , Publisher <ByteBuffer > source ,
322- GridFSUploadOptions uploadOptions ) {
323-
324- this .fileId = fileId ;
325- this .filename = filename ;
326- this .source = source ;
327- this .uploadOptions = uploadOptions ;
328- }
317+ private record UploadCallback (BsonValue fileId , String filename , Publisher <ByteBuffer > source ,
318+ GridFSUploadOptions uploadOptions ) implements ReactiveBucketCallback <Void > {
329319
330320 @ Override
331321 public GridFSUploadPublisher <Void > doInBucket (GridFSBucket bucket ) {
332322 return bucket .uploadFromPublisher (fileId , filename , source , uploadOptions );
333323 }
334324 }
335325
336- private static class AutoIdCreatingUploadCallback implements ReactiveBucketCallback <ObjectId > {
337-
338- private final String filename ;
339- private final Publisher <ByteBuffer > source ;
340- private final GridFSUploadOptions uploadOptions ;
341-
342- public AutoIdCreatingUploadCallback (String filename , Publisher <ByteBuffer > source ,
343- GridFSUploadOptions uploadOptions ) {
344-
345- this .filename = filename ;
346- this .source = source ;
347- this .uploadOptions = uploadOptions ;
348- }
326+ private record AutoIdCreatingUploadCallback (String filename , Publisher <ByteBuffer > source ,
327+ GridFSUploadOptions uploadOptions ) implements ReactiveBucketCallback <ObjectId > {
349328
350329 @ Override
351330 public GridFSUploadPublisher <ObjectId > doInBucket (GridFSBucket bucket ) {
352331 return bucket .uploadFromPublisher (filename , source , uploadOptions );
353332 }
354333 }
355334
356- private static class DeleteCallback implements ReactiveBucketCallback <Void > {
357-
358- private final BsonValue id ;
359-
360- public DeleteCallback (BsonValue id ) {
361- this .id = id ;
362- }
335+ private record DeleteCallback (BsonValue id ) implements ReactiveBucketCallback <Void > {
363336
364337 @ Override
365338 public Publisher <Void > doInBucket (GridFSBucket bucket ) {
0 commit comments