Polishing.
Align type variable naming with imperative extensions(I, O). Add extension without accepting KClass. Update since tags and tests. See #3508. Original pull request: #893.
This commit is contained in:
@@ -217,37 +217,46 @@ inline fun <reified T : Any, reified E : Any> ReactiveMongoOperations.findDistin
|
||||
* Extension for [ReactiveMongoOperations.aggregate] leveraging reified type parameters.
|
||||
*
|
||||
* @author Wonwoo Lee
|
||||
* @since 3.1
|
||||
* @since 3.1.4
|
||||
*/
|
||||
inline fun <reified T : Any> ReactiveMongoOperations.aggregate(aggregation: TypedAggregation<*>, collectionName: String): Flux<T> =
|
||||
this.aggregate(aggregation, collectionName, T::class.java)
|
||||
inline fun <reified O : Any> ReactiveMongoOperations.aggregate(
|
||||
aggregation: TypedAggregation<*>,
|
||||
collectionName: String
|
||||
): Flux<O> =
|
||||
this.aggregate(aggregation, collectionName, O::class.java)
|
||||
|
||||
/**
|
||||
* Extension for [ReactiveMongoOperations.aggregate] leveraging reified type parameters.
|
||||
*
|
||||
* @author Wonwoo Lee
|
||||
* @since 3.1
|
||||
* @since 3.1.4
|
||||
*/
|
||||
inline fun <reified T : Any> ReactiveMongoOperations.aggregate(aggregation: TypedAggregation<*>): Flux<T> =
|
||||
this.aggregate(aggregation, T::class.java)
|
||||
inline fun <reified O : Any> ReactiveMongoOperations.aggregate(aggregation: TypedAggregation<*>): Flux<O> =
|
||||
this.aggregate(aggregation, O::class.java)
|
||||
|
||||
/**
|
||||
* Extension for [ReactiveMongoOperations.aggregate] leveraging reified type parameters.
|
||||
*
|
||||
* @author Wonwoo Lee
|
||||
* @since 3.1
|
||||
* @author Mark Paluch
|
||||
* @since 3.1.4
|
||||
*/
|
||||
inline fun <reified T : Any> ReactiveMongoOperations.aggregate(aggregation: Aggregation, entityClass: KClass<*>): Flux<T> =
|
||||
this.aggregate(aggregation, entityClass.java, T::class.java)
|
||||
inline fun <reified I : Any, reified O : Any> ReactiveMongoOperations.aggregate(
|
||||
aggregation: Aggregation
|
||||
): Flux<O> =
|
||||
this.aggregate(aggregation, I::class.java, O::class.java)
|
||||
|
||||
/**
|
||||
* Extension for [ReactiveMongoOperations.aggregate] leveraging reified type parameters.
|
||||
*
|
||||
* @author Wonwoo Lee
|
||||
* @since 3.1
|
||||
* @since 3.1.4
|
||||
*/
|
||||
inline fun <reified T : Any> ReactiveMongoOperations.aggregate(aggregation: Aggregation, collectionName: String): Flux<T> =
|
||||
this.aggregate(aggregation, collectionName, T::class.java)
|
||||
inline fun <reified O : Any> ReactiveMongoOperations.aggregate(
|
||||
aggregation: Aggregation,
|
||||
collectionName: String
|
||||
): Flux<O> =
|
||||
this.aggregate(aggregation, collectionName, O::class.java)
|
||||
|
||||
/**
|
||||
* Extension for [ReactiveMongoOperations.geoNear] leveraging reified type parameters.
|
||||
|
||||
@@ -30,6 +30,7 @@ import reactor.core.publisher.Mono
|
||||
* @author Sebastien Deleuze
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Wonwoo Lee
|
||||
*/
|
||||
class ReactiveMongoOperationsExtensionsTests {
|
||||
|
||||
@@ -607,10 +608,17 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mockk<Query>()
|
||||
|
||||
operations.findDistinct<String>(query, "field", First::class)
|
||||
verify { operations.findDistinct(query, "field", First::class.java, String::class.java) }
|
||||
verify {
|
||||
operations.findDistinct(
|
||||
query,
|
||||
"field",
|
||||
First::class.java,
|
||||
String::class.java
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // #893
|
||||
fun `aggregate(TypedAggregation, String, KClass) should call java counterpart`() {
|
||||
|
||||
val aggregation = mockk<TypedAggregation<String>>()
|
||||
@@ -619,7 +627,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
verify { operations.aggregate(aggregation, "foo", First::class.java) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // #893
|
||||
fun `aggregate(TypedAggregation, KClass) should call java counterpart`() {
|
||||
|
||||
val aggregation = mockk<TypedAggregation<String>>()
|
||||
@@ -628,16 +636,22 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
verify { operations.aggregate(aggregation, First::class.java) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // #893
|
||||
fun `aggregate(Aggregation, KClass) should call java counterpart`() {
|
||||
|
||||
val aggregation = mockk<Aggregation>()
|
||||
|
||||
operations.aggregate<First>(aggregation, String::class)
|
||||
verify { operations.aggregate(aggregation, String::class.java, First::class.java) }
|
||||
operations.aggregate<String, First>(aggregation)
|
||||
verify {
|
||||
operations.aggregate(
|
||||
aggregation,
|
||||
String::class.java,
|
||||
First::class.java
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // #893
|
||||
fun `aggregate(Aggregation, String) should call java counterpart`() {
|
||||
|
||||
val aggregation = mockk<Aggregation>()
|
||||
|
||||
Reference in New Issue
Block a user