Skip to content

Commit 019d737

Browse files
authored
Kotlin coroutine update. (#1135)
As the Flow interface is not stable for inheritance in 3rd party libraries, use delegation instead. JAVA-4950
1 parent 6332c14 commit 019d737

File tree

7 files changed

+8
-7
lines changed

7 files changed

+8
-7
lines changed

driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/AggregateFlow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import org.bson.conversions.Bson
3434
* @param T The type of the result.
3535
* @see [Aggregation command](https://www.mongodb.com/docs/manual/reference/command/aggregate)
3636
*/
37-
public class AggregateFlow<T : Any>(private val wrapped: AggregatePublisher<T>) : Flow<T> {
37+
public class AggregateFlow<T : Any>(private val wrapped: AggregatePublisher<T>) : Flow<T> by wrapped.asFlow() {
3838

3939
/**
4040
* Sets the number of documents to return per batch.

driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/DistinctFlow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import org.bson.conversions.Bson
3030
* @param T The type of the result.
3131
* @see [Distinct command](https://www.mongodb.com/docs/manual/reference/command/distinct/)
3232
*/
33-
public class DistinctFlow<T : Any>(private val wrapped: DistinctPublisher<T>) : Flow<T> {
33+
public class DistinctFlow<T : Any>(private val wrapped: DistinctPublisher<T>) : Flow<T> by wrapped.asFlow() {
3434

3535
/**
3636
* Sets the number of documents to return per batch.

driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/FindFlow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import org.bson.conversions.Bson
3434
* @param T The type of the result.
3535
* @see [Collection filter](https://www.mongodb.com/docs/manual/reference/method/db.collection.find/)
3636
*/
37-
public class FindFlow<T : Any>(private val wrapped: FindPublisher<T>) : Flow<T> {
37+
public class FindFlow<T : Any>(private val wrapped: FindPublisher<T>) : Flow<T> by wrapped.asFlow() {
3838

3939
/**
4040
* Sets the number of documents to return per batch.

driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/ListCollectionsFlow.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import org.bson.conversions.Bson
2929
* @param T The type of the result.
3030
* @see [List collections](https://www.mongodb.com/docs/manual/reference/command/listCollections/)
3131
*/
32-
public class ListCollectionsFlow<T : Any>(private val wrapped: ListCollectionsPublisher<T>) : Flow<T> {
32+
public class ListCollectionsFlow<T : Any>(private val wrapped: ListCollectionsPublisher<T>) :
33+
Flow<T> by wrapped.asFlow() {
3334
/**
3435
* Sets the maximum execution time on the server for this operation.
3536
*

driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/ListDatabasesFlow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import org.bson.conversions.Bson
2929
* @param T The type of the result.
3030
* @see [List databases](https://www.mongodb.com/docs/manual/reference/command/listDatabases/)
3131
*/
32-
public class ListDatabasesFlow<T : Any>(private val wrapped: ListDatabasesPublisher<T>) : Flow<T> {
32+
public class ListDatabasesFlow<T : Any>(private val wrapped: ListDatabasesPublisher<T>) : Flow<T> by wrapped.asFlow() {
3333
/**
3434
* Sets the maximum execution time on the server for this operation.
3535
*

driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/ListIndexesFlow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import org.bson.BsonValue
2828
* @param T The type of the result.
2929
* @see [List indexes](https://www.mongodb.com/docs/manual/reference/command/listIndexes/)
3030
*/
31-
public class ListIndexesFlow<T : Any>(private val wrapped: ListIndexesPublisher<T>) : Flow<T> {
31+
public class ListIndexesFlow<T : Any>(private val wrapped: ListIndexesPublisher<T>) : Flow<T> by wrapped.asFlow() {
3232
/**
3333
* Sets the maximum execution time on the server for this operation.
3434
*

driver-kotlin-coroutine/src/main/kotlin/com/mongodb/kotlin/client/coroutine/MapReduceFlow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import org.bson.conversions.Bson
3636
* @see [Map Reduce](https://www.mongodb.com/docs/manual/reference/command/mapReduce/)
3737
*/
3838
@Deprecated("Map Reduce has been deprecated. Use Aggregation instead", replaceWith = ReplaceWith(""))
39-
public class MapReduceFlow<T : Any>(private val wrapped: MapReducePublisher<T>) : Flow<T> {
39+
public class MapReduceFlow<T : Any>(private val wrapped: MapReducePublisher<T>) : Flow<T> by wrapped.asFlow() {
4040
/**
4141
* Sets the number of documents to return per batch.
4242
*

0 commit comments

Comments
 (0)