|
18 | 18 | import java.util.Optional;
|
19 | 19 |
|
20 | 20 | import org.springframework.data.mongodb.core.query.Collation;
|
| 21 | +import org.springframework.lang.Nullable; |
21 | 22 | import org.springframework.util.Assert;
|
22 | 23 |
|
23 | 24 | /**
|
|
29 | 30 | */
|
30 | 31 | public class CollectionOptions {
|
31 | 32 |
|
32 |
| - private Long maxDocuments; |
33 |
| - private Long size; |
34 |
| - private Boolean capped; |
35 |
| - private Collation collation; |
| 33 | + private @Nullable Long maxDocuments; |
| 34 | + private @Nullable Long size; |
| 35 | + private @Nullable Boolean capped; |
| 36 | + private @Nullable Collation collation; |
36 | 37 |
|
37 | 38 | /**
|
38 | 39 | * Constructs a new <code>CollectionOptions</code> instance.
|
39 | 40 | *
|
40 |
| - * @param size the collection size in bytes, this data space is preallocated. |
41 |
| - * @param maxDocuments the maximum number of documents in the collection. |
| 41 | + * @param size the collection size in bytes, this data space is preallocated. Can be {@literal null}. |
| 42 | + * @param maxDocuments the maximum number of documents in the collection. Can be {@literal null}. |
42 | 43 | * @param capped true to created a "capped" collection (fixed size with auto-FIFO behavior based on insertion order),
|
43 |
| - * false otherwise. |
| 44 | + * false otherwise. Can be {@literal null}. |
44 | 45 | * @deprecated since 2.0 please use {@link CollectionOptions#empty()} as entry point.
|
45 | 46 | */
|
46 | 47 | @Deprecated
|
47 |
| - public CollectionOptions(Long size, Long maxDocuments, Boolean capped) { |
| 48 | + public CollectionOptions(@Nullable Long size, @Nullable Long maxDocuments, @Nullable Boolean capped) { |
48 | 49 | this(size, maxDocuments, capped, null);
|
49 | 50 | }
|
50 | 51 |
|
51 |
| - private CollectionOptions(Long size, Long maxDocuments, Boolean capped, Collation collation) { |
| 52 | + private CollectionOptions(@Nullable Long size, @Nullable Long maxDocuments, @Nullable Boolean capped, |
| 53 | + @Nullable Collation collation) { |
52 | 54 |
|
53 | 55 | this.maxDocuments = maxDocuments;
|
54 | 56 | this.size = size;
|
@@ -120,7 +122,7 @@ public CollectionOptions size(long size) {
|
120 | 122 | * @return new {@link CollectionOptions}.
|
121 | 123 | * @since 2.0
|
122 | 124 | */
|
123 |
| - public CollectionOptions collation(Collation collation) { |
| 125 | + public CollectionOptions collation(@Nullable Collation collation) { |
124 | 126 | return new CollectionOptions(size, maxDocuments, capped, collation);
|
125 | 127 | }
|
126 | 128 |
|
|
0 commit comments