Skip to content

Commit d2e68cd

Browse files
sdeleuzeodrotbohm
authored andcommitted
DATAMONGO-1689 - Polishing.
Improve Maven Kotlin configuration for now + documentation fixes. Original pull request: #463.
1 parent 7ed48f5 commit d2e68cd

File tree

3 files changed

+72
-112
lines changed

3 files changed

+72
-112
lines changed

spring-data-mongodb/pom.xml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<properties>
1919
<objenesis>1.3</objenesis>
2020
<equalsverifier>1.5</equalsverifier>
21-
<kotlin>1.1.2-3</kotlin>
21+
<kotlin>1.1.2-5</kotlin>
2222
</properties>
2323

2424
<dependencies>
@@ -233,7 +233,7 @@
233233
</dependency>
234234
<dependency>
235235
<groupId>org.jetbrains.kotlin</groupId>
236-
<artifactId>kotlin-stdlib-jre8</artifactId>
236+
<artifactId>kotlin-stdlib</artifactId>
237237
<version>${kotlin}</version>
238238
<optional>true</optional>
239239
</dependency>
@@ -252,8 +252,22 @@
252252
<dependency>
253253
<groupId>com.nhaarman</groupId>
254254
<artifactId>mockito-kotlin</artifactId>
255-
<version>1.4.0</version>
255+
<version>1.5.0</version>
256256
<scope>test</scope>
257+
<exclusions>
258+
<exclusion>
259+
<groupId>org.jetbrains.kotlin</groupId>
260+
<artifactId>kotlin-stdlib</artifactId>
261+
</exclusion>
262+
<exclusion>
263+
<groupId>org.jetbrains.kotlin</groupId>
264+
<artifactId>kotlin-reflect</artifactId>
265+
</exclusion>
266+
<exclusion>
267+
<groupId>org.mockito</groupId>
268+
<artifactId>mockito-core</artifactId>
269+
</exclusion>
270+
</exclusions>
257271
</dependency>
258272

259273
</dependencies>

spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/MongoOperationsExtensions.kt

Lines changed: 33 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ fun <T : Any> MongoOperations.getCollectionName(entityClass: KClass<T>): String
4444
getCollectionName(entityClass.java)
4545

4646
/**
47-
* Extension for [MongoOperations.getCollectionName] avoiding requiring the type parameter
48-
* thanks to Kotlin reified type parameters.
47+
* Extension for [MongoOperations.getCollectionName] leveraging reified type parameters.
4948
*
5049
* @author Sebastien Deleuze
5150
* @since 2.0
@@ -54,8 +53,7 @@ inline fun <reified T : Any> MongoOperations.getCollectionName(): String =
5453
getCollectionName(T::class.java)
5554

5655
/**
57-
* Extension for [MongoOperations.execute] avoiding requiring the type parameter
58-
* thanks to Kotlin reified type parameters.
56+
* Extension for [MongoOperations.execute] leveraging reified type parameters.
5957
*
6058
* @author Sebastien Deleuze
6159
* @since 2.0
@@ -64,8 +62,7 @@ inline fun <reified T : Any> MongoOperations.execute(action: CollectionCallback<
6462
execute(T::class.java, action)
6563

6664
/**
67-
* Extension for [MongoOperations.stream] avoiding requiring the type parameter
68-
* thanks to Kotlin reified type parameters.
65+
* Extension for [MongoOperations.stream] leveraging reified type parameters.
6966
*
7067
* @author Sebastien Deleuze
7168
* @since 2.0
@@ -74,8 +71,7 @@ inline fun <reified T : Any> MongoOperations.stream(query: Query): CloseableIter
7471
stream(query, T::class.java)
7572

7673
/**
77-
* Extension for [MongoOperations.stream] avoiding requiring the type parameter
78-
* thanks to Kotlin reified type parameters.
74+
* Extension for [MongoOperations.stream] leveraging reified type parameters.
7975
*
8076
* @author Sebastien Deleuze
8177
* @since 2.0
@@ -95,8 +91,7 @@ fun <T : Any> MongoOperations.createCollection(entityClass: KClass<T>, collectio
9591
else createCollection(entityClass.java)
9692

9793
/**
98-
* Extension for [MongoOperations.createCollection] avoiding requiring the type parameter
99-
* thanks to Kotlin reified type parameters.
94+
* Extension for [MongoOperations.createCollection] leveraging reified type parameters.
10095
*
10196
* @author Sebastien Deleuze
10297
* @since 2.0
@@ -116,8 +111,7 @@ fun <T : Any> MongoOperations.collectionExists(entityClass: KClass<T>): Boolean
116111
collectionExists(entityClass.java)
117112

118113
/**
119-
* Extension for [MongoOperations.collectionExists] avoiding requiring the type parameter
120-
* thanks to Kotlin reified type parameters.
114+
* Extension for [MongoOperations.collectionExists] leveraging reified type parameters.
121115
*
122116
* @author Sebastien Deleuze
123117
* @since 2.0
@@ -136,8 +130,7 @@ fun <T : Any> MongoOperations.dropCollection(entityClass: KClass<T>) {
136130
}
137131

138132
/**
139-
* Extension for [MongoOperations.dropCollection] avoiding requiring the type parameter
140-
* thanks to Kotlin reified type parameters.
133+
* Extension for [MongoOperations.dropCollection] leveraging reified type parameters.
141134
*
142135
* @author Sebastien Deleuze
143136
* @since 2.0
@@ -156,8 +149,7 @@ fun <T : Any> MongoOperations.indexOps(entityClass: KClass<T>): IndexOperations
156149
indexOps(entityClass.java)
157150

158151
/**
159-
* Extension for [MongoOperations.indexOps] avoiding requiring the type parameter
160-
* thanks to Kotlin reified type parameters.
152+
* Extension for [MongoOperations.indexOps] leveraging reified type parameters.
161153
*
162154
* @author Sebastien Deleuze
163155
* @since 2.0
@@ -176,7 +168,7 @@ fun <T : Any> MongoOperations.bulkOps(bulkMode: BulkMode, entityClass: KClass<T>
176168
else bulkOps(bulkMode, entityClass.java)
177169

178170
/**
179-
* Extension for [MongoOperations.bulkOps] providing a [KClass] based variant.
171+
* Extension for [MongoOperations.bulkOps] leveraging reified type parameters.
180172
*
181173
* @author Sebastien Deleuze
182174
* @since 2.0
@@ -187,8 +179,7 @@ inline fun <reified T : Any> MongoOperations.bulkOps(bulkMode: BulkMode, collect
187179
else bulkOps(bulkMode, T::class.java)
188180

189181
/**
190-
* Extension for [MongoOperations.findAll] avoiding requiring the type parameter
191-
* thanks to Kotlin reified type parameters
182+
* Extension for [MongoOperations.findAll] leveraging reified type parameters.
192183
*
193184
* @author Sebastien Deleuze
194185
* @since 2.0
@@ -197,8 +188,7 @@ inline fun <reified T : Any> MongoOperations.findAll(collectionName: String? = n
197188
if (collectionName != null) findAll(T::class.java, collectionName) else findAll(T::class.java)
198189

199190
/**
200-
* Extension for [MongoOperations.group] avoiding requiring the type parameter
201-
* thanks to Kotlin reified type parameters
191+
* Extension for [MongoOperations.group] leveraging reified type parameters.
202192
*
203193
* @author Sebastien Deleuze
204194
* @since 2.0
@@ -207,8 +197,7 @@ inline fun <reified T : Any> MongoOperations.group(inputCollectionName: String,
207197
group(inputCollectionName, groupBy, T::class.java)
208198

209199
/**
210-
* Extension for [MongoOperations.group] avoiding requiring the type parameter
211-
* thanks to Kotlin reified type parameters
200+
* Extension for [MongoOperations.group] leveraging reified type parameters.
212201
*
213202
* @author Sebastien Deleuze
214203
* @since 2.0
@@ -217,8 +206,7 @@ inline fun <reified T : Any> MongoOperations.group(criteria: Criteria, inputColl
217206
group(criteria, inputCollectionName, groupBy, T::class.java)
218207

219208
/**
220-
* Extension for [MongoOperations.aggregate] avoiding requiring the type parameter
221-
* thanks to Kotlin reified type parameters
209+
* Extension for [MongoOperations.aggregate] leveraging reified type parameters.
222210
*
223211
* @author Sebastien Deleuze
224212
* @since 2.0
@@ -227,8 +215,7 @@ inline fun <reified O : Any> MongoOperations.aggregate(aggregation: Aggregation,
227215
aggregate(aggregation, inputType.java, O::class.java)
228216

229217
/**
230-
* Extension for [MongoOperations.aggregate] avoiding requiring the type parameter
231-
* thanks to Kotlin reified type parameters
218+
* Extension for [MongoOperations.aggregate] leveraging reified type parameters.
232219
*
233220
* @author Sebastien Deleuze
234221
* @since 2.0
@@ -237,8 +224,7 @@ inline fun <reified O : Any> MongoOperations.aggregate(aggregation: Aggregation,
237224
aggregate(aggregation, collectionName, O::class.java)
238225

239226
/**
240-
* Extension for [MongoOperations.aggregateStream] avoiding requiring the type parameter
241-
* thanks to Kotlin reified type parameters
227+
* Extension for [MongoOperations.aggregateStream] leveraging reified type parameters.
242228
*
243229
* @author Sebastien Deleuze
244230
* @since 2.0
@@ -247,8 +233,7 @@ inline fun <reified O : Any> MongoOperations.aggregateStream(aggregation: Aggreg
247233
aggregateStream(aggregation, inputType.java, O::class.java)
248234

249235
/**
250-
* Extension for [MongoOperations.aggregateStream] avoiding requiring the type parameter
251-
* thanks to Kotlin reified type parameters
236+
* Extension for [MongoOperations.aggregateStream] leveraging reified type parameters.
252237
*
253238
* @author Sebastien Deleuze
254239
* @since 2.0
@@ -257,8 +242,7 @@ inline fun <reified O : Any> MongoOperations.aggregateStream(aggregation: Aggreg
257242
aggregateStream(aggregation, collectionName, O::class.java)
258243

259244
/**
260-
* Extension for [MongoOperations.mapReduce] avoiding requiring the type parameter
261-
* thanks to Kotlin reified type parameters
245+
* Extension for [MongoOperations.mapReduce] leveraging reified type parameters.
262246
*
263247
* @author Sebastien Deleuze
264248
* @since 2.0
@@ -268,8 +252,7 @@ inline fun <reified T : Any> MongoOperations.mapReduce(collectionName: String, m
268252
else mapReduce(collectionName, mapFunction, reduceFunction, T::class.java)
269253

270254
/**
271-
* Extension for [MongoOperations.mapReduce] avoiding requiring the type parameter
272-
* thanks to Kotlin reified type parameters
255+
* Extension for [MongoOperations.mapReduce] leveraging reified type parameters.
273256
*
274257
* @author Sebastien Deleuze
275258
* @since 52.0
@@ -279,8 +262,7 @@ inline fun <reified T : Any> MongoOperations.mapReduce(query: Query, collectionN
279262
else mapReduce(query, collectionName, mapFunction, reduceFunction, T::class.java)
280263

281264
/**
282-
* Extension for [MongoOperations.geoNear] avoiding requiring the type parameter
283-
* thanks to Kotlin reified type parameters
265+
* Extension for [MongoOperations.geoNear] leveraging reified type parameters.
284266
*
285267
* @author Sebastien Deleuze
286268
* @since 2.0
@@ -290,8 +272,7 @@ inline fun <reified T : Any> MongoOperations.geoNear(near: NearQuery, collection
290272
else geoNear(near, T::class.java)
291273

292274
/**
293-
* Extension for [MongoOperations.findOne] avoiding requiring the type parameter
294-
* thanks to Kotlin reified type parameters
275+
* Extension for [MongoOperations.findOne] leveraging reified type parameters.
295276
*
296277
* @author Sebastien Deleuze
297278
* @since 2.0
@@ -300,8 +281,7 @@ inline fun <reified T : Any> MongoOperations.findOne(query: Query, collectionNam
300281
if (collectionName != null) findOne(query, T::class.java, collectionName) else findOne(query, T::class.java)
301282

302283
/**
303-
* Extension for [MongoOperations.exists] avoiding requiring the type parameter
304-
* thanks to Kotlin reified type parameters
284+
* Extension for [MongoOperations.exists] providing a [KClass] based variant.
305285
*
306286
* @author Sebastien Deleuze
307287
* @since 2.0
@@ -311,8 +291,7 @@ fun <T : Any> MongoOperations.exists(query: Query, entityClass: KClass<T>, colle
311291
else exists(query, entityClass.java)
312292

313293
/**
314-
* Extension for [MongoOperations.exists] avoiding requiring the type parameter
315-
* thanks to Kotlin reified type parameters
294+
* Extension for [MongoOperations.exists] leveraging reified type parameters.
316295
*
317296
* @author Sebastien Deleuze
318297
* @since 2.0
@@ -323,8 +302,7 @@ inline fun <reified T : Any> MongoOperations.exists(query: Query, collectionName
323302
else exists(query, T::class.java)
324303

325304
/**
326-
* Extension for [MongoOperations.find] avoiding requiring the type parameter
327-
* thanks to Kotlin reified type parameters
305+
* Extension for [MongoOperations.find] leveraging reified type parameters.
328306
*
329307
* @author Sebastien Deleuze
330308
* @since 2.0
@@ -334,8 +312,7 @@ inline fun <reified T : Any> MongoOperations.find(query: Query, collectionName:
334312
else find(query, T::class.java)
335313

336314
/**
337-
* Extension for [MongoOperations.findById] avoiding requiring the type parameter
338-
* thanks to Kotlin reified type parameters
315+
* Extension for [MongoOperations.findById] leveraging reified type parameters.
339316
*
340317
* @author Sebastien Deleuze
341318
* @since 2.0
@@ -345,8 +322,7 @@ inline fun <reified T : Any> MongoOperations.findById(id: Any, collectionName: S
345322
else findById(id, T::class.java)
346323

347324
/**
348-
* Extension for [MongoOperations.findAndModify] avoiding requiring the type parameter
349-
* thanks to Kotlin reified type parameters
325+
* Extension for [MongoOperations.findAndModify] leveraging reified type parameters.
350326
*
351327
* @author Sebastien Deleuze
352328
* @since 2.0
@@ -356,8 +332,7 @@ inline fun <reified T : Any> MongoOperations.findAndModify(query: Query, update:
356332
else findAndModify(query, update, options, T::class.java)
357333

358334
/**
359-
* Extension for [MongoOperations.findAndRemove] avoiding requiring the type parameter
360-
* thanks to Kotlin reified type parameters
335+
* Extension for [MongoOperations.findAndRemove] leveraging reified type parameters.
361336
*
362337
* @author Sebastien Deleuze
363338
* @since 2.0
@@ -367,8 +342,7 @@ inline fun <reified T : Any> MongoOperations.findAndRemove(query: Query, collect
367342
else findAndRemove(query, T::class.java)
368343

369344
/**
370-
* Extension for [MongoOperations.count] avoiding requiring the type parameter
371-
* thanks to Kotlin reified type parameters
345+
* Extension for [MongoOperations.count] providing a [KClass] based variant.
372346
*
373347
* @author Sebastien Deleuze
374348
* @since 2.0
@@ -378,8 +352,7 @@ fun <T : Any> MongoOperations.count(query: Query = Query(), entityClass: KClass<
378352
else count(query, entityClass.java)
379353

380354
/**
381-
* Extension for [MongoOperations.count] avoiding requiring the type parameter
382-
* thanks to Kotlin reified type parameters
355+
* Extension for [MongoOperations.count] leveraging reified type parameters.
383356
*
384357
* @author Sebastien Deleuze
385358
* @since 2.0
@@ -409,8 +382,7 @@ fun <T : Any> MongoOperations.upsert(query: Query, update: Update, entityClass:
409382
else upsert(query, update, entityClass.java)
410383

411384
/**
412-
* Extension for [MongoOperations.upsert] avoiding requiring the type parameter
413-
* thanks to Kotlin reified type parameters.
385+
* Extension for [MongoOperations.upsert] leveraging reified type parameters.
414386
*
415387
* @author Sebastien Deleuze
416388
* @since 2.0
@@ -431,8 +403,7 @@ fun <T : Any> MongoOperations.updateFirst(query: Query, update: Update, entityCl
431403
else updateFirst(query, update, entityClass.java)
432404

433405
/**
434-
* Extension for [MongoOperations.updateFirst] avoiding requiring the type parameter
435-
* thanks to Kotlin reified type parameters.
406+
* Extension for [MongoOperations.updateFirst] leveraging reified type parameters.
436407
*
437408
* @author Sebastien Deleuze
438409
* @since 2.0
@@ -454,8 +425,7 @@ fun <T : Any> MongoOperations.updateMulti(query: Query, update: Update, entityCl
454425
else updateMulti(query, update, entityClass.java)
455426

456427
/**
457-
* Extension for [MongoOperations.updateMulti] avoiding requiring the type parameter
458-
* thanks to Kotlin reified type parameters.
428+
* Extension for [MongoOperations.updateMulti] leveraging reified type parameters.
459429
*
460430
* @author Sebastien Deleuze
461431
* @since 2.0
@@ -476,8 +446,7 @@ fun <T : Any> MongoOperations.remove(query: Query, entityClass: KClass<T>, colle
476446
else remove(query, entityClass.java)
477447

478448
/**
479-
* Extension for [MongoOperations.remove] avoiding requiring the type parameter
480-
* thanks to Kotlin reified type parameters.
449+
* Extension for [MongoOperations.remove] leveraging reified type parameters.
481450
*
482451
* @author Sebastien Deleuze
483452
* @since 2.0
@@ -488,8 +457,7 @@ inline fun <reified T : Any> MongoOperations.remove(query: Query, collectionName
488457
else remove(query, T::class.java)
489458

490459
/**
491-
* Extension for [MongoOperations.findAllAndRemove] avoiding requiring the type parameter
492-
* thanks to Kotlin reified type parameters.
460+
* Extension for [MongoOperations.findAllAndRemove] leveraging reified type parameters.
493461
*
494462
* @author Sebastien Deleuze
495463
* @since 2.0

0 commit comments

Comments
 (0)