DATAMONGO-2086 - Polishing.
Add fix for bound reified type in fluent MapReduce operations. Also add missing reified type extension to FindDistinct with projection. Original Pull Request: #609
This commit is contained in:
@@ -65,3 +65,12 @@ inline fun <reified T : Any> ExecutableFindOperation.FindWithProjection<*>.asTyp
|
||||
*/
|
||||
fun <T : Any> ExecutableFindOperation.DistinctWithProjection.asType(resultType: KClass<T>): ExecutableFindOperation.TerminatingDistinct<T> =
|
||||
`as`(resultType.java);
|
||||
|
||||
/**
|
||||
* Extension for [ExecutableFindOperation.DistinctWithProjection. as] leveraging reified type parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
*/
|
||||
inline fun <reified T : Any> ExecutableFindOperation.DistinctWithProjection.asType(): ExecutableFindOperation.DistinctWithProjection =
|
||||
`as`(T::class.java)
|
||||
|
||||
@@ -41,7 +41,7 @@ inline fun <reified T : Any> ExecutableMapReduceOperation.mapReduce(): Executabl
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
*/
|
||||
fun <T : Any> ExecutableMapReduceOperation.MapReduceWithProjection<T>.asType(resultType: KClass<T>): ExecutableMapReduceOperation.MapReduceWithQuery<T> =
|
||||
fun <T : Any> ExecutableMapReduceOperation.MapReduceWithProjection<*>.asType(resultType: KClass<T>): ExecutableMapReduceOperation.MapReduceWithQuery<T> =
|
||||
`as`(resultType.java)
|
||||
|
||||
/**
|
||||
@@ -50,5 +50,5 @@ fun <T : Any> ExecutableMapReduceOperation.MapReduceWithProjection<T>.asType(res
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
*/
|
||||
inline fun <reified T : Any> ExecutableMapReduceOperation.MapReduceWithProjection<T>.asType(): ExecutableMapReduceOperation.MapReduceWithQuery<T> =
|
||||
inline fun <reified T : Any> ExecutableMapReduceOperation.MapReduceWithProjection<*>.asType(): ExecutableMapReduceOperation.MapReduceWithQuery<T> =
|
||||
`as`(T::class.java)
|
||||
|
||||
@@ -61,3 +61,12 @@ inline fun <reified T : Any> ReactiveFindOperation.FindWithProjection<*>.asType(
|
||||
*/
|
||||
fun <T : Any> ReactiveFindOperation.DistinctWithProjection.asType(resultType: KClass<T>): ReactiveFindOperation.TerminatingDistinct<T> =
|
||||
`as`(resultType.java);
|
||||
|
||||
/**
|
||||
* Extension for [ReactiveFindOperation.DistinctWithProjection. as] leveraging reified type parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
*/
|
||||
inline fun <reified T : Any> ReactiveFindOperation.DistinctWithProjection.asType(): ReactiveFindOperation.DistinctWithProjection =
|
||||
`as`(T::class.java)
|
||||
|
||||
@@ -41,7 +41,7 @@ inline fun <reified T : Any> ReactiveMapReduceOperation.mapReduce(): ReactiveMap
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
*/
|
||||
fun <T : Any> ReactiveMapReduceOperation.MapReduceWithProjection<T>.asType(resultType: KClass<T>): ReactiveMapReduceOperation.MapReduceWithQuery<T> =
|
||||
fun <T : Any> ReactiveMapReduceOperation.MapReduceWithProjection<*>.asType(resultType: KClass<T>): ReactiveMapReduceOperation.MapReduceWithQuery<T> =
|
||||
`as`(resultType.java)
|
||||
|
||||
/**
|
||||
@@ -50,5 +50,5 @@ fun <T : Any> ReactiveMapReduceOperation.MapReduceWithProjection<T>.asType(resul
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
*/
|
||||
inline fun <reified T : Any> ReactiveMapReduceOperation.MapReduceWithProjection<T>.asType(): ReactiveMapReduceOperation.MapReduceWithQuery<T> =
|
||||
inline fun <reified T : Any> ReactiveMapReduceOperation.MapReduceWithProjection<*>.asType(): ReactiveMapReduceOperation.MapReduceWithQuery<T> =
|
||||
`as`(T::class.java)
|
||||
|
||||
@@ -73,4 +73,11 @@ class ExecutableFindOperationExtensionsTests {
|
||||
distinctWithProjection.asType(User::class)
|
||||
verify(distinctWithProjection).`as`(User::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-2086
|
||||
fun `ExecutableFindOperation#DistinctWithProjection#asType() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
distinctWithProjection.asType<User>()
|
||||
verify(distinctWithProjection).`as`(User::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,17 +49,17 @@ class ExecutableMapReduceOperationExtensionsTests {
|
||||
verify(operation).mapReduce(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1929
|
||||
@Test // DATAMONGO-1929, DATAMONGO-2086
|
||||
fun `ExecutableMapReduceOperation#MapReduceWithProjection#asType(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operationWithProjection.asType(First::class)
|
||||
verify(operationWithProjection).`as`(First::class.java)
|
||||
operationWithProjection.asType(User::class)
|
||||
verify(operationWithProjection).`as`(User::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1929
|
||||
@Test // DATAMONGO-1929, DATAMONGO-2086
|
||||
fun `ExecutableMapReduceOperation#MapReduceWithProjection#asType() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operationWithProjection.asType()
|
||||
verify(operationWithProjection).`as`(First::class.java)
|
||||
operationWithProjection.asType<User>()
|
||||
verify(operationWithProjection).`as`(User::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +72,11 @@ class ReactiveFindOperationExtensionsTests {
|
||||
distinctWithProjection.asType(User::class)
|
||||
verify(distinctWithProjection).`as`(User::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-2086
|
||||
fun `ReactiveFind#DistinctWithProjection#asType() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
distinctWithProjection.asType<User>()
|
||||
verify(distinctWithProjection).`as`(User::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,17 +49,17 @@ class ReactiveMapReduceOperationExtensionsTests {
|
||||
verify(operation).mapReduce(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1929
|
||||
@Test // DATAMONGO-1929, DATAMONGO-2086
|
||||
fun `ReactiveMapReduceOperation#MapReduceWithProjection#asType(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operationWithProjection.asType(First::class)
|
||||
verify(operationWithProjection).`as`(First::class.java)
|
||||
operationWithProjection.asType(User::class)
|
||||
verify(operationWithProjection).`as`(User::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1929
|
||||
@Test // DATAMONGO-1929, DATAMONGO-2086
|
||||
fun `ReactiveMapReduceOperation#MapReduceWithProjection#asType() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operationWithProjection.asType()
|
||||
verify(operationWithProjection).`as`(First::class.java)
|
||||
operationWithProjection.asType<User>()
|
||||
verify(operationWithProjection).`as`(User::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user