@@ -82,7 +82,7 @@ public ReactiveGridFsTemplate(ReactiveMongoDatabaseFactory dbFactory, MongoConve
82
82
*
83
83
* @param dbFactory must not be {@literal null}.
84
84
* @param converter must not be {@literal null}.
85
- * @param bucket
85
+ * @param bucket can be {@literal null}.
86
86
*/
87
87
public ReactiveGridFsTemplate (ReactiveMongoDatabaseFactory dbFactory , MongoConverter converter ,
88
88
@ Nullable String bucket ) {
@@ -96,7 +96,7 @@ public ReactiveGridFsTemplate(ReactiveMongoDatabaseFactory dbFactory, MongoConve
96
96
* @param dataBufferFactory must not be {@literal null}.
97
97
* @param dbFactory must not be {@literal null}.
98
98
* @param converter must not be {@literal null}.
99
- * @param bucket
99
+ * @param bucket can be {@literal null}.
100
100
*/
101
101
public ReactiveGridFsTemplate (DataBufferFactory dataBufferFactory , ReactiveMongoDatabaseFactory dbFactory ,
102
102
MongoConverter converter , @ Nullable String bucket ) {
@@ -117,6 +117,8 @@ public Mono<ObjectId> store(Publisher<DataBuffer> content, @Nullable String file
117
117
return store (content , filename , contentType , toDocument (metadata ));
118
118
}
119
119
120
+ @ Override
121
+ @ SuppressWarnings ("unchecked" )
120
122
public <T > Mono <T > store (GridFsObject <T , Publisher <DataBuffer >> upload ) {
121
123
122
124
GridFSUploadOptions uploadOptions = computeUploadOptionsFor (upload .getOptions ().getContentType (),
@@ -274,6 +276,7 @@ public FindCallback(Query query, Document queryObject, Document sortObject) {
274
276
this .sortObject = sortObject ;
275
277
}
276
278
279
+ @ Override
277
280
public GridFSFindPublisher doInBucket (GridFSBucket bucket ) {
278
281
279
282
GridFSFindPublisher findPublisher = bucket .find (queryObject ).sort (sortObject );
@@ -311,55 +314,25 @@ public GridFSFindPublisher doInBucket(GridFSBucket bucket) {
311
314
}
312
315
}
313
316
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 > {
329
319
330
320
@ Override
331
321
public GridFSUploadPublisher <Void > doInBucket (GridFSBucket bucket ) {
332
322
return bucket .uploadFromPublisher (fileId , filename , source , uploadOptions );
333
323
}
334
324
}
335
325
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 > {
349
328
350
329
@ Override
351
330
public GridFSUploadPublisher <ObjectId > doInBucket (GridFSBucket bucket ) {
352
331
return bucket .uploadFromPublisher (filename , source , uploadOptions );
353
332
}
354
333
}
355
334
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 > {
363
336
364
337
@ Override
365
338
public Publisher <Void > doInBucket (GridFSBucket bucket ) {
0 commit comments