41
41
import org .springframework .data .mongodb .core .query .Update ;
42
42
import org .springframework .data .mongodb .core .query .UpdateDefinition ;
43
43
import org .springframework .data .util .Pair ;
44
+ import org .springframework .lang .Contract ;
44
45
import org .springframework .util .Assert ;
45
46
46
47
import com .mongodb .MongoBulkWriteException ;
@@ -115,6 +116,7 @@ void setDefaultWriteConcern(@Nullable WriteConcern defaultWriteConcern) {
115
116
}
116
117
117
118
@ Override
119
+ @ Contract ("_ -> this" )
118
120
public BulkOperations insert (Object document ) {
119
121
120
122
Assert .notNull (document , "Document must not be null" );
@@ -127,6 +129,7 @@ public BulkOperations insert(Object document) {
127
129
}
128
130
129
131
@ Override
132
+ @ Contract ("_ -> this" )
130
133
public BulkOperations insert (List <? extends Object > documents ) {
131
134
132
135
Assert .notNull (documents , "Documents must not be null" );
@@ -137,6 +140,7 @@ public BulkOperations insert(List<? extends Object> documents) {
137
140
}
138
141
139
142
@ Override
143
+ @ Contract ("_, _ -> this" )
140
144
public BulkOperations updateOne (Query query , UpdateDefinition update ) {
141
145
142
146
Assert .notNull (query , "Query must not be null" );
@@ -146,6 +150,7 @@ public BulkOperations updateOne(Query query, UpdateDefinition update) {
146
150
}
147
151
148
152
@ Override
153
+ @ Contract ("_ -> this" )
149
154
public BulkOperations updateOne (List <Pair <Query , UpdateDefinition >> updates ) {
150
155
151
156
Assert .notNull (updates , "Updates must not be null" );
@@ -158,6 +163,7 @@ public BulkOperations updateOne(List<Pair<Query, UpdateDefinition>> updates) {
158
163
}
159
164
160
165
@ Override
166
+ @ Contract ("_, _ -> this" )
161
167
public BulkOperations updateMulti (Query query , UpdateDefinition update ) {
162
168
163
169
Assert .notNull (query , "Query must not be null" );
@@ -169,6 +175,7 @@ public BulkOperations updateMulti(Query query, UpdateDefinition update) {
169
175
}
170
176
171
177
@ Override
178
+ @ Contract ("_ -> this" )
172
179
public BulkOperations updateMulti (List <Pair <Query , UpdateDefinition >> updates ) {
173
180
174
181
Assert .notNull (updates , "Updates must not be null" );
@@ -181,11 +188,13 @@ public BulkOperations updateMulti(List<Pair<Query, UpdateDefinition>> updates) {
181
188
}
182
189
183
190
@ Override
191
+ @ Contract ("_, _ -> this" )
184
192
public BulkOperations upsert (Query query , UpdateDefinition update ) {
185
193
return update (query , update , true , true );
186
194
}
187
195
188
196
@ Override
197
+ @ Contract ("_ -> this" )
189
198
public BulkOperations upsert (List <Pair <Query , Update >> updates ) {
190
199
191
200
for (Pair <Query , Update > update : updates ) {
@@ -196,6 +205,7 @@ public BulkOperations upsert(List<Pair<Query, Update>> updates) {
196
205
}
197
206
198
207
@ Override
208
+ @ Contract ("_ -> this" )
199
209
public BulkOperations remove (Query query ) {
200
210
201
211
Assert .notNull (query , "Query must not be null" );
@@ -209,6 +219,7 @@ public BulkOperations remove(Query query) {
209
219
}
210
220
211
221
@ Override
222
+ @ Contract ("_ -> this" )
212
223
public BulkOperations remove (List <Query > removes ) {
213
224
214
225
Assert .notNull (removes , "Removals must not be null" );
@@ -221,6 +232,7 @@ public BulkOperations remove(List<Query> removes) {
221
232
}
222
233
223
234
@ Override
235
+ @ Contract ("_, _, _ -> this" )
224
236
public BulkOperations replaceOne (Query query , Object replacement , FindAndReplaceOptions options ) {
225
237
226
238
Assert .notNull (query , "Query must not be null" );
0 commit comments