Skip to content

Commit

Permalink
Kotlin coroutine update. (#1135)
Browse files Browse the repository at this point in the history
As the Flow interface is not stable for inheritance in 3rd party libraries,
use delegation instead.

JAVA-4950
  • Loading branch information
rozza authored Jun 13, 2023
1 parent 6332c14 commit 019d737
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import org.bson.conversions.Bson
* @param T The type of the result.
* @see [Aggregation command](https://www.mongodb.com/docs/manual/reference/command/aggregate)
*/
public class AggregateFlow<T : Any>(private val wrapped: AggregatePublisher<T>) : Flow<T> {
public class AggregateFlow<T : Any>(private val wrapped: AggregatePublisher<T>) : Flow<T> by wrapped.asFlow() {

/**
* Sets the number of documents to return per batch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.bson.conversions.Bson
* @param T The type of the result.
* @see [Distinct command](https://www.mongodb.com/docs/manual/reference/command/distinct/)
*/
public class DistinctFlow<T : Any>(private val wrapped: DistinctPublisher<T>) : Flow<T> {
public class DistinctFlow<T : Any>(private val wrapped: DistinctPublisher<T>) : Flow<T> by wrapped.asFlow() {

/**
* Sets the number of documents to return per batch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import org.bson.conversions.Bson
* @param T The type of the result.
* @see [Collection filter](https://www.mongodb.com/docs/manual/reference/method/db.collection.find/)
*/
public class FindFlow<T : Any>(private val wrapped: FindPublisher<T>) : Flow<T> {
public class FindFlow<T : Any>(private val wrapped: FindPublisher<T>) : Flow<T> by wrapped.asFlow() {

/**
* Sets the number of documents to return per batch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import org.bson.conversions.Bson
* @param T The type of the result.
* @see [List collections](https://www.mongodb.com/docs/manual/reference/command/listCollections/)
*/
public class ListCollectionsFlow<T : Any>(private val wrapped: ListCollectionsPublisher<T>) : Flow<T> {
public class ListCollectionsFlow<T : Any>(private val wrapped: ListCollectionsPublisher<T>) :
Flow<T> by wrapped.asFlow() {
/**
* Sets the maximum execution time on the server for this operation.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.bson.conversions.Bson
* @param T The type of the result.
* @see [List databases](https://www.mongodb.com/docs/manual/reference/command/listDatabases/)
*/
public class ListDatabasesFlow<T : Any>(private val wrapped: ListDatabasesPublisher<T>) : Flow<T> {
public class ListDatabasesFlow<T : Any>(private val wrapped: ListDatabasesPublisher<T>) : Flow<T> by wrapped.asFlow() {
/**
* Sets the maximum execution time on the server for this operation.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.bson.BsonValue
* @param T The type of the result.
* @see [List indexes](https://www.mongodb.com/docs/manual/reference/command/listIndexes/)
*/
public class ListIndexesFlow<T : Any>(private val wrapped: ListIndexesPublisher<T>) : Flow<T> {
public class ListIndexesFlow<T : Any>(private val wrapped: ListIndexesPublisher<T>) : Flow<T> by wrapped.asFlow() {
/**
* Sets the maximum execution time on the server for this operation.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import org.bson.conversions.Bson
* @see [Map Reduce](https://www.mongodb.com/docs/manual/reference/command/mapReduce/)
*/
@Deprecated("Map Reduce has been deprecated. Use Aggregation instead", replaceWith = ReplaceWith(""))
public class MapReduceFlow<T : Any>(private val wrapped: MapReducePublisher<T>) : Flow<T> {
public class MapReduceFlow<T : Any>(private val wrapped: MapReducePublisher<T>) : Flow<T> by wrapped.asFlow() {
/**
* Sets the number of documents to return per batch.
*
Expand Down

0 comments on commit 019d737

Please sign in to comment.