Package org.infinispan.reactive
Class RxJavaInterop
- java.lang.Object
-
- org.infinispan.reactive.RxJavaInterop
-
public class RxJavaInterop extends java.lang.ObjectStatic factory class that provides methods to obtain commonly used instances for interoperation between RxJava and standard JRE.- Since:
- 10.0
- Author:
- wburns
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.function.Function<java.util.concurrent.CompletionStage<?>,io.reactivex.Completable>completionStageToCompletable()static <E> java.util.function.Function<java.util.concurrent.CompletionStage<E>,io.reactivex.Flowable<E>>completionStageToPublisher()Provides an interop function that can be used to convert a CompletionStage into a Flowable.static <K,V>
io.reactivex.functions.Function<java.util.Map.Entry<K,V>,K>entryToKeyFunction()Provides aFunctionthat can be used to convert from an instance ofMap.Entryto the key of the entry.static <E> io.reactivex.functions.Function<io.reactivex.Flowable<E>,java.util.concurrent.CompletionStage<java.lang.Void>>flowableToCompletionStage()Provides an interop function that can be used to convert a Flowable into a CompletionStage.static <E> io.reactivex.Flowable<E>fromStream(java.util.stream.Stream<E> stream)Transforms aStreamto aFlowable.static <E> io.reactivex.functions.Function<io.reactivex.Maybe<E>,java.util.concurrent.CompletionStage<E>>maybeToCompletionStage()Provides an interop function that can be used to convert a Maybe into a CompletionStage.static <E> io.reactivex.functions.Function<io.reactivex.Single<E>,java.util.concurrent.CompletionStage<E>>singleToCompletionStage()Provides an interop function that can be used to convert a Single into a CompletionStage.
-
-
-
Method Detail
-
singleToCompletionStage
public static <E> io.reactivex.functions.Function<io.reactivex.Single<E>,java.util.concurrent.CompletionStage<E>> singleToCompletionStage()
Provides an interop function that can be used to convert a Single into a CompletionStage. Note that this function is not from the standard java.util.function package, but ratherFunctionto interop better with theSingle.to(Function)method.- Type Parameters:
E- underlying type- Returns:
- rxjava function to convert Single to CompletionStage
-
maybeToCompletionStage
public static <E> io.reactivex.functions.Function<io.reactivex.Maybe<E>,java.util.concurrent.CompletionStage<E>> maybeToCompletionStage()
Provides an interop function that can be used to convert a Maybe into a CompletionStage. Note that this function is not from the standard java.util.function package, but ratherFunctionto interop better with theMaybe.to(Function)method.- Type Parameters:
E- underlying type- Returns:
- rxjava function to convert Maybe to CompletionStage
-
flowableToCompletionStage
public static <E> io.reactivex.functions.Function<io.reactivex.Flowable<E>,java.util.concurrent.CompletionStage<java.lang.Void>> flowableToCompletionStage()
Provides an interop function that can be used to convert a Flowable into a CompletionStage. Note that this function is not from the standard java.util.function package, but ratherFunctionto interop better with theMaybe.to(Function)method. Any published values are ignored and the returned CompletionStage is completed when the Flowable completes or completed exceptionally if the Flowable has an error.- Returns:
- rxjava function to convert Flowable to CompletionStage
-
completionStageToPublisher
public static <E> java.util.function.Function<java.util.concurrent.CompletionStage<E>,io.reactivex.Flowable<E>> completionStageToPublisher()
Provides an interop function that can be used to convert a CompletionStage into a Flowable. Note that this function is from the standard java.util.function package since we don't want the method to throw an exceptionRemember that the CompletionStage when completing normally MUST have a non null value!
- Type Parameters:
E- underlying type- Returns:
- java.util function to convert CompletionStage to Flowable
-
completionStageToCompletable
public static java.util.function.Function<java.util.concurrent.CompletionStage<?>,io.reactivex.Completable> completionStageToCompletable()
-
fromStream
public static <E> io.reactivex.Flowable<E> fromStream(java.util.stream.Stream<E> stream)
Transforms aStreamto aFlowable. Note that the resulting Flowable can only be subscribed to once as a Stream only allows a single terminal operation performed upon it. When the Flowable is completed, either exceptionally or normally, the Stream is also closed- Type Parameters:
E- inner type- Parameters:
stream- the stream to transform to a Flowable- Returns:
- Flowable that can only be subscribed to once
-
entryToKeyFunction
public static <K,V> io.reactivex.functions.Function<java.util.Map.Entry<K,V>,K> entryToKeyFunction()
Provides aFunctionthat can be used to convert from an instance ofMap.Entryto the key of the entry. This is useful for the instance passed to a method likeFlowable.map(Function).- Type Parameters:
K- key typeV- value type- Returns:
- rxjava function to convert from a Map.Entry to its key.
-
-