Skip to content

Commit 4ea6dd4

Browse files
DATAMONGO-1805 - Update GridFsOperations documentation.
Fix return type in reference documentation and update Javadoc.
1 parent 24cd25f commit 4ea6dd4

File tree

2 files changed

+32
-29
lines changed

2 files changed

+32
-29
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsOperations.java

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
import org.springframework.lang.Nullable;
2626

2727
import com.mongodb.client.gridfs.GridFSFindIterable;
28-
import com.mongodb.gridfs.GridFSFile;
2928

3029
/**
3130
* Collection of operations to store and read files from MongoDB GridFS.
32-
*
31+
*
3332
* @author Oliver Gierke
3433
* @author Philipp Schneider
3534
* @author Thomas Darimont
@@ -40,98 +39,102 @@ public interface GridFsOperations extends ResourcePatternResolver {
4039

4140
/**
4241
* Stores the given content into a file with the given name.
43-
*
42+
*
4443
* @param content must not be {@literal null}.
4544
* @param filename must not be {@literal null} or empty.
46-
* @return the {@link GridFSFile} just created
45+
* @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model.GridFSFile} just created.
4746
*/
4847
ObjectId store(InputStream content, String filename);
4948

5049
/**
5150
* Stores the given content into a file with the given name.
52-
*
51+
*
5352
* @param content must not be {@literal null}.
5453
* @param metadata can be {@literal null}.
55-
* @return the {@link GridFSFile} just created
54+
* @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model.GridFSFile} just created.
5655
*/
5756
ObjectId store(InputStream content, @Nullable Object metadata);
5857

5958
/**
6059
* Stores the given content into a file with the given name.
61-
*
60+
*
6261
* @param content must not be {@literal null}.
6362
* @param metadata can be {@literal null}.
64-
* @return the {@link GridFSFile} just created
63+
* @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model.GridFSFile} just created.
6564
*/
6665
ObjectId store(InputStream content, @Nullable Document metadata);
6766

6867
/**
6968
* Stores the given content into a file with the given name and content type.
70-
*
69+
*
7170
* @param content must not be {@literal null}.
7271
* @param filename must not be {@literal null} or empty.
7372
* @param contentType can be {@literal null}.
74-
* @return the {@link GridFSFile} just created
73+
* @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model.GridFSFile} just created.
7574
*/
7675
ObjectId store(InputStream content, @Nullable String filename, @Nullable String contentType);
7776

7877
/**
7978
* Stores the given content into a file with the given name using the given metadata. The metadata object will be
8079
* marshalled before writing.
81-
*
80+
*
8281
* @param content must not be {@literal null}.
8382
* @param filename can be {@literal null} or empty.
8483
* @param metadata can be {@literal null}.
85-
* @return the {@link GridFSFile} just created
84+
* @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model.GridFSFile} just created.
8685
*/
8786
ObjectId store(InputStream content, @Nullable String filename, @Nullable Object metadata);
8887

8988
/**
9089
* Stores the given content into a file with the given name and content type using the given metadata. The metadata
9190
* object will be marshalled before writing.
92-
*
91+
*
9392
* @param content must not be {@literal null}.
9493
* @param filename must not be {@literal null} or empty.
9594
* @param contentType can be {@literal null}.
9695
* @param metadata can be {@literal null}
97-
* @return the {@link GridFSFile} just created
96+
* @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model.GridFSFile} just created.
9897
*/
99-
ObjectId store(InputStream content, @Nullable String filename, @Nullable String contentType, @Nullable Object metadata);
98+
ObjectId store(InputStream content, @Nullable String filename, @Nullable String contentType,
99+
@Nullable Object metadata);
100100

101101
/**
102102
* Stores the given content into a file with the given name using the given metadata.
103-
*
103+
*
104104
* @param content must not be {@literal null}.
105105
* @param filename must not be {@literal null} or empty.
106106
* @param metadata can be {@literal null}.
107-
* @return the {@link GridFSFile} just created
107+
* @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model.GridFSFile} just created.
108108
*/
109109
ObjectId store(InputStream content, @Nullable String filename, @Nullable Document metadata);
110110

111111
/**
112112
* Stores the given content into a file with the given name and content type using the given metadata.
113-
*
113+
*
114114
* @param content must not be {@literal null}.
115115
* @param filename must not be {@literal null} or empty.
116116
* @param contentType can be {@literal null}.
117117
* @param metadata can be {@literal null}.
118-
* @return the {@link GridFSFile} just created
118+
* @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model.GridFSFile} just created.
119119
*/
120-
ObjectId store(InputStream content, @Nullable String filename, @Nullable String contentType, @Nullable Document metadata);
120+
ObjectId store(InputStream content, @Nullable String filename, @Nullable String contentType,
121+
@Nullable Document metadata);
121122

122123
/**
123124
* Returns all files matching the given query. Note, that currently {@link Sort} criterias defined at the
124125
* {@link Query} will not be regarded as MongoDB does not support ordering for GridFS file access.
125-
*
126+
*
126127
* @see <a href="https://jira.mongodb.org/browse/JAVA-431">MongoDB Jira: JAVA-431</a>
127128
* @param query must not be {@literal null}.
128-
* @return
129+
* @return {@link GridFSFindIterable} to obtain results from. Eg. by calling
130+
* {@link GridFSFindIterable#into(java.util.Collection)}.
129131
*/
130132
GridFSFindIterable find(Query query);
131133

132134
/**
133-
* Returns a single file matching the given query or {@literal null} in case no file matches.
134-
*
135+
* Returns a single {@link com.mongodb.client.gridfs.model.GridFSFile} matching the given query or {@literal null} in
136+
* case no file matches.
137+
*
135138
* @param query must not be {@literal null}.
136139
* @return
137140
*/
@@ -140,14 +143,14 @@ public interface GridFsOperations extends ResourcePatternResolver {
140143

141144
/**
142145
* Deletes all files matching the given {@link Query}.
143-
*
146+
*
144147
* @param query must not be {@literal null}.
145148
*/
146149
void delete(Query query);
147150

148151
/**
149-
* Returns all {@link GridFsResource} with the given file name.
150-
*
152+
* Returns the {@link GridFsResource} with the given file name.
153+
*
151154
* @param filename must not be {@literal null}.
152155
* @return the resource if it exists or {@literal null}.
153156
* @see ResourcePatternResolver#getResource(String)
@@ -156,7 +159,7 @@ public interface GridFsOperations extends ResourcePatternResolver {
156159

157160
/**
158161
* Returns all {@link GridFsResource}s matching the given file name pattern.
159-
*
162+
*
160163
* @param filenamePattern must not be {@literal null}.
161164
* @return
162165
* @see ResourcePatternResolver#getResources(String)

src/main/asciidoc/reference/mongodb.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,7 @@ class GridFsClient {
26022602
26032603
@Test
26042604
public void findFilesInGridFs() {
2605-
List<GridFSDBFile> result = operations.find(query(whereFilename().is("filename.txt")))
2605+
GridFSFindIterable result = operations.find(query(whereFilename().is("filename.txt")))
26062606
}
26072607
}
26082608
----

0 commit comments

Comments
 (0)