From d2e68cd92590958564f3921004a7e0400b8699fc Mon Sep 17 00:00:00 2001 From: Sebastien Deleuze Date: Wed, 14 Jun 2017 15:54:09 +0200 Subject: [PATCH] DATAMONGO-1689 - Polishing. Improve Maven Kotlin configuration for now + documentation fixes. Original pull request: #463. --- spring-data-mongodb/pom.xml | 20 +++- .../mongodb/core/MongoOperationsExtensions.kt | 98 +++++++------------ .../core/ReactiveMongoOperationsExtensions.kt | 66 +++++-------- 3 files changed, 72 insertions(+), 112 deletions(-) diff --git a/spring-data-mongodb/pom.xml b/spring-data-mongodb/pom.xml index 7e964146a..712d2395c 100644 --- a/spring-data-mongodb/pom.xml +++ b/spring-data-mongodb/pom.xml @@ -18,7 +18,7 @@ 1.3 1.5 - 1.1.2-3 + 1.1.2-5 @@ -233,7 +233,7 @@ org.jetbrains.kotlin - kotlin-stdlib-jre8 + kotlin-stdlib ${kotlin} true @@ -252,8 +252,22 @@ com.nhaarman mockito-kotlin - 1.4.0 + 1.5.0 test + + + org.jetbrains.kotlin + kotlin-stdlib + + + org.jetbrains.kotlin + kotlin-reflect + + + org.mockito + mockito-core + + diff --git a/spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/MongoOperationsExtensions.kt b/spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/MongoOperationsExtensions.kt index 62abe677f..7956df812 100644 --- a/spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/MongoOperationsExtensions.kt +++ b/spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/MongoOperationsExtensions.kt @@ -44,8 +44,7 @@ fun MongoOperations.getCollectionName(entityClass: KClass): String getCollectionName(entityClass.java) /** - * Extension for [MongoOperations.getCollectionName] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.getCollectionName] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -54,8 +53,7 @@ inline fun MongoOperations.getCollectionName(): String = getCollectionName(T::class.java) /** - * Extension for [MongoOperations.execute] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.execute] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -64,8 +62,7 @@ inline fun MongoOperations.execute(action: CollectionCallback< execute(T::class.java, action) /** - * Extension for [MongoOperations.stream] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.stream] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -74,8 +71,7 @@ inline fun MongoOperations.stream(query: Query): CloseableIter stream(query, T::class.java) /** - * Extension for [MongoOperations.stream] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.stream] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -95,8 +91,7 @@ fun MongoOperations.createCollection(entityClass: KClass, collectio else createCollection(entityClass.java) /** - * Extension for [MongoOperations.createCollection] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.createCollection] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -116,8 +111,7 @@ fun MongoOperations.collectionExists(entityClass: KClass): Boolean collectionExists(entityClass.java) /** - * Extension for [MongoOperations.collectionExists] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.collectionExists] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -136,8 +130,7 @@ fun MongoOperations.dropCollection(entityClass: KClass) { } /** - * Extension for [MongoOperations.dropCollection] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.dropCollection] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -156,8 +149,7 @@ fun MongoOperations.indexOps(entityClass: KClass): IndexOperations indexOps(entityClass.java) /** - * Extension for [MongoOperations.indexOps] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.indexOps] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -176,7 +168,7 @@ fun MongoOperations.bulkOps(bulkMode: BulkMode, entityClass: KClass else bulkOps(bulkMode, entityClass.java) /** - * Extension for [MongoOperations.bulkOps] providing a [KClass] based variant. + * Extension for [MongoOperations.bulkOps] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -187,8 +179,7 @@ inline fun MongoOperations.bulkOps(bulkMode: BulkMode, collect else bulkOps(bulkMode, T::class.java) /** - * Extension for [MongoOperations.findAll] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.findAll] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -197,8 +188,7 @@ inline fun MongoOperations.findAll(collectionName: String? = n if (collectionName != null) findAll(T::class.java, collectionName) else findAll(T::class.java) /** - * Extension for [MongoOperations.group] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.group] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -207,8 +197,7 @@ inline fun MongoOperations.group(inputCollectionName: String, group(inputCollectionName, groupBy, T::class.java) /** - * Extension for [MongoOperations.group] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.group] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -217,8 +206,7 @@ inline fun MongoOperations.group(criteria: Criteria, inputColl group(criteria, inputCollectionName, groupBy, T::class.java) /** - * Extension for [MongoOperations.aggregate] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.aggregate] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -227,8 +215,7 @@ inline fun MongoOperations.aggregate(aggregation: Aggregation, aggregate(aggregation, inputType.java, O::class.java) /** - * Extension for [MongoOperations.aggregate] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.aggregate] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -237,8 +224,7 @@ inline fun MongoOperations.aggregate(aggregation: Aggregation, aggregate(aggregation, collectionName, O::class.java) /** - * Extension for [MongoOperations.aggregateStream] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.aggregateStream] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -247,8 +233,7 @@ inline fun MongoOperations.aggregateStream(aggregation: Aggreg aggregateStream(aggregation, inputType.java, O::class.java) /** - * Extension for [MongoOperations.aggregateStream] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.aggregateStream] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -257,8 +242,7 @@ inline fun MongoOperations.aggregateStream(aggregation: Aggreg aggregateStream(aggregation, collectionName, O::class.java) /** - * Extension for [MongoOperations.mapReduce] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.mapReduce] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -268,8 +252,7 @@ inline fun MongoOperations.mapReduce(collectionName: String, m else mapReduce(collectionName, mapFunction, reduceFunction, T::class.java) /** - * Extension for [MongoOperations.mapReduce] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.mapReduce] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 52.0 @@ -279,8 +262,7 @@ inline fun MongoOperations.mapReduce(query: Query, collectionN else mapReduce(query, collectionName, mapFunction, reduceFunction, T::class.java) /** - * Extension for [MongoOperations.geoNear] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.geoNear] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -290,8 +272,7 @@ inline fun MongoOperations.geoNear(near: NearQuery, collection else geoNear(near, T::class.java) /** - * Extension for [MongoOperations.findOne] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.findOne] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -300,8 +281,7 @@ inline fun MongoOperations.findOne(query: Query, collectionNam if (collectionName != null) findOne(query, T::class.java, collectionName) else findOne(query, T::class.java) /** - * Extension for [MongoOperations.exists] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.exists] providing a [KClass] based variant. * * @author Sebastien Deleuze * @since 2.0 @@ -311,8 +291,7 @@ fun MongoOperations.exists(query: Query, entityClass: KClass, colle else exists(query, entityClass.java) /** - * Extension for [MongoOperations.exists] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.exists] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -323,8 +302,7 @@ inline fun MongoOperations.exists(query: Query, collectionName else exists(query, T::class.java) /** - * Extension for [MongoOperations.find] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.find] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -334,8 +312,7 @@ inline fun MongoOperations.find(query: Query, collectionName: else find(query, T::class.java) /** - * Extension for [MongoOperations.findById] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.findById] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -345,8 +322,7 @@ inline fun MongoOperations.findById(id: Any, collectionName: S else findById(id, T::class.java) /** - * Extension for [MongoOperations.findAndModify] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.findAndModify] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -356,8 +332,7 @@ inline fun MongoOperations.findAndModify(query: Query, update: else findAndModify(query, update, options, T::class.java) /** - * Extension for [MongoOperations.findAndRemove] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.findAndRemove] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -367,8 +342,7 @@ inline fun MongoOperations.findAndRemove(query: Query, collect else findAndRemove(query, T::class.java) /** - * Extension for [MongoOperations.count] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.count] providing a [KClass] based variant. * * @author Sebastien Deleuze * @since 2.0 @@ -378,8 +352,7 @@ fun MongoOperations.count(query: Query = Query(), entityClass: KClass< else count(query, entityClass.java) /** - * Extension for [MongoOperations.count] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [MongoOperations.count] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -409,8 +382,7 @@ fun MongoOperations.upsert(query: Query, update: Update, entityClass: else upsert(query, update, entityClass.java) /** - * Extension for [MongoOperations.upsert] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.upsert] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -431,8 +403,7 @@ fun MongoOperations.updateFirst(query: Query, update: Update, entityCl else updateFirst(query, update, entityClass.java) /** - * Extension for [MongoOperations.updateFirst] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.updateFirst] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -454,8 +425,7 @@ fun MongoOperations.updateMulti(query: Query, update: Update, entityCl else updateMulti(query, update, entityClass.java) /** - * Extension for [MongoOperations.updateMulti] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.updateMulti] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -476,8 +446,7 @@ fun MongoOperations.remove(query: Query, entityClass: KClass, colle else remove(query, entityClass.java) /** - * Extension for [MongoOperations.remove] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.remove] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -488,8 +457,7 @@ inline fun MongoOperations.remove(query: Query, collectionName else remove(query, T::class.java) /** - * Extension for [MongoOperations.findAllAndRemove] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [MongoOperations.findAllAndRemove] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 diff --git a/spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/ReactiveMongoOperationsExtensions.kt b/spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/ReactiveMongoOperationsExtensions.kt index a3f6911d6..5e92c8db4 100644 --- a/spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/ReactiveMongoOperationsExtensions.kt +++ b/spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/ReactiveMongoOperationsExtensions.kt @@ -37,8 +37,7 @@ fun ReactiveMongoOperations.indexOps(entityClass: KClass): Reactive indexOps(entityClass.java) /** - * Extension for [ReactiveMongoOperations.indexOps] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.indexOps] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -47,8 +46,7 @@ inline fun ReactiveMongoOperations.indexOps(): ReactiveIndexOp indexOps(T::class.java) /** - * Extension for [ReactiveMongoOperations.execute] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.execute] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -66,8 +64,7 @@ fun ReactiveMongoOperations.createCollection(entityClass: KClass, c if (collectionOptions != null) createCollection(entityClass.java, collectionOptions) else createCollection(entityClass.java) /** - * Extension for [ReactiveMongoOperations.createCollection] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.createCollection] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -85,8 +82,7 @@ fun ReactiveMongoOperations.collectionExists(entityClass: KClass): collectionExists(entityClass.java) /** - * Extension for [ReactiveMongoOperations.collectionExists] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.collectionExists] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -104,8 +100,7 @@ fun ReactiveMongoOperations.dropCollection(entityClass: KClass): Mo dropCollection(entityClass.java) /** - * Extension for [ReactiveMongoOperations.dropCollection] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.dropCollection] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -115,8 +110,7 @@ inline fun ReactiveMongoOperations.dropCollection(): Mono ReactiveMongoOperations.findAll(collectionName: Str if (collectionName != null) findAll(T::class.java, collectionName) else findAll(T::class.java) /** - * Extension for [ReactiveMongoOperations.findOne] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.findOne] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -135,8 +128,7 @@ inline fun ReactiveMongoOperations.findOne(query: Query, colle if (collectionName != null) findOne(query, T::class.java, collectionName) else findOne(query, T::class.java) /** - * Extension for [ReactiveMongoOperations.exists] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.exists] providing a [KClass] based variant. * * @author Sebastien Deleuze * @since 2.0 @@ -145,8 +137,7 @@ fun ReactiveMongoOperations.exists(query: Query, entityClass: KClass ReactiveMongoOperations.exists(query: Query, collec if (collectionName != null) exists(query, T::class.java, collectionName) else exists(query, T::class.java) /** - * Extension for [ReactiveMongoOperations.find] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.find] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -166,8 +156,7 @@ inline fun ReactiveMongoOperations.find(query: Query, collecti if (collectionName != null) find(query, T::class.java, collectionName) else find(query, T::class.java) /** - * Extension for [ReactiveMongoOperations.findById] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.findById] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -176,8 +165,7 @@ inline fun ReactiveMongoOperations.findById(id: Any, collectio if (collectionName != null) findById(id, T::class.java, collectionName) else findById(id, T::class.java) /** - * Extension for [ReactiveMongoOperations.geoNear] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.geoNear] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -186,8 +174,7 @@ inline fun ReactiveMongoOperations.geoNear(near: NearQuery, co if (collectionName != null) geoNear(near, T::class.java, collectionName) else geoNear(near, T::class.java) /** - * Extension for [ReactiveMongoOperations.findAndModify] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.findAndModify] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -196,8 +183,7 @@ inline fun ReactiveMongoOperations.findAndModify(query: Query, if (collectionName != null) findAndModify(query, update, options, T::class.java, collectionName) else findAndModify(query, update, options, T::class.java) /** - * Extension for [ReactiveMongoOperations.findAndRemove] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.findAndRemove] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -207,8 +193,7 @@ inline fun ReactiveMongoOperations.findAndRemove(query: Query, else findAndRemove(query, T::class.java) /** - * Extension for [ReactiveMongoOperations.count] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.count] providing a [KClass] based variant. * * @author Sebastien Deleuze * @since 2.0 @@ -218,8 +203,7 @@ fun ReactiveMongoOperations.count(query: Query = Query(), entityClass: else count(query, entityClass.java) /** - * Extension for [ReactiveMongoOperations.count] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters + * Extension for [ReactiveMongoOperations.count] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -257,8 +241,7 @@ fun ReactiveMongoOperations.upsert(query: Query, update: Update, entit if (collectionName != null) upsert(query, update, entityClass.java, collectionName) else upsert(query, update, entityClass.java) /** - * Extension for [ReactiveMongoOperations.upsert] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.upsert] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -279,8 +262,7 @@ fun ReactiveMongoOperations.updateFirst(query: Query, update: Update, else updateFirst(query, update, entityClass.java) /** - * Extension for [ReactiveMongoOperations.updateFirst] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.updateFirst] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -301,8 +283,7 @@ fun ReactiveMongoOperations.updateMulti(query: Query, update: Update, else updateMulti(query, update, entityClass.java) /** - * Extension for [ReactiveMongoOperations.updateMulti] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.updateMulti] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -323,8 +304,7 @@ fun ReactiveMongoOperations.remove(query: Query, entityClass: KClass ReactiveMongoOperations.remove(query: Query, collec else remove(query, T::class.java) /** - * Extension for [ReactiveMongoOperations.findAllAndRemove] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.findAllAndRemove] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0 @@ -346,8 +325,7 @@ inline fun ReactiveMongoOperations.findAllAndRemove(query: Que findAllAndRemove(query, T::class.java) /** - * Extension for [ReactiveMongoOperations.tail] avoiding requiring the type parameter - * thanks to Kotlin reified type parameters. + * Extension for [ReactiveMongoOperations.tail] leveraging reified type parameters. * * @author Sebastien Deleuze * @since 2.0