Package hu.akarnokd.rxjava3.interop
Class RxJavaInterop
- java.lang.Object
-
- hu.akarnokd.rxjava3.interop.RxJavaInterop
-
public final class RxJavaInterop extends java.lang.ObjectConversion methods for converting between 1.x and 3.x reactive types, composing backpressure and cancellation through.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CompletabletoV1Completable(CompletableSource source)Converts an 3.x CompletableSource (the base type of 3.x Completable) into a 1.x Completable, composing cancellation (unsubscription) through.static <T> CompletabletoV1Completable(MaybeSource<T> source)Converts an 3.x MaybeSource (the base type of 3.x Maybe) into a 1.x Completable, composing cancellation (unsubscription) through and ignoring the success value.static <T> Observable<T>toV1Observable(ObservableSource<T> source, BackpressureStrategy strategy)Converts a 3.x ObservableSource (the base type of 3.x Observable) into an 1.x Observable instance, applying the specified backpressure strategy and composing the cancellation (unsubscription) through.static <T> Observable<T>toV1Observable(org.reactivestreams.Publisher<T> source)Converts a Reactive-Streams Publisher of any kind (the base type of 3.x Flowable) into an 1.x Observable, composing the backpressure and cancellation (unsubscription) through.static <T,R>
Observable.Operator<R,T>toV1Operator(FlowableOperator<R,T> operator)Convert the 3.x FlowableOperator into a 1.x Observable.Operator.static SchedulertoV1Scheduler(Scheduler scheduler)static <T> Single<T>toV1Single(MaybeSource<T> source)Converts an 3.x MaybeSource (the base type of 3.x Maybe) into a 1.x Single, composing cancellation (unsubscription) through and signalling NoSuchElementException if the MaybeSource is empty.static <T> Single<T>toV1Single(SingleSource<T> source)Converts an 3.x SingleSource (the base type of 3.x Single) into a 1.x Single, composing cancellation (unsubscription) through.static <T> Subject<T,T>toV1Subject(FlowableProcessor<T> processor)Wraps a 3.x FlowableProcessor into a 1.x Subject.static <T> Subject<T,T>toV1Subject(Subject<T> subject)Wraps a 3.x Subject into a 1.x Subject.static SubscriptiontoV1Subscription(Disposable disposable)Convert the 3.xDisposableinto a 1.xSubscription.static Completable.TransformertoV1Transformer(CompletableTransformer transformer)Convert the 3.x CompletableTransformer into a 1.x Completable.Transformer.static <T,R>
Observable.Transformer<T,R>toV1Transformer(FlowableTransformer<T,R> transformer)Convert the 3.x FlowableTransformer into a 1.x Observable.Transformer.static <T,R>
Observable.Transformer<T,R>toV1Transformer(ObservableTransformer<T,R> transformer, BackpressureStrategy strategy)Convert the 3.x ObservableTransformer into a 1.x Observable.Transformer.static <T,R>
Single.Transformer<T,R>toV1Transformer(SingleTransformer<T,R> transformer)Convert the 3.x SingleTransformer into a 1.x Single.Transformer.static CompletabletoV3Completable(Completable source)Converts an 1.x Completable into a 3.x Completable, composing cancellation (unsubscription) through.static DisposabletoV3Disposable(Subscription subscription)Convert the 1.xSubscriptioninto a 3.xDisposable.static <T> Flowable<T>toV3Flowable(Observable<T> source)Converts an 1.x Observable into a 3.x Flowable, composing the backpressure and cancellation (unsubscription) through.static <T> Maybe<T>toV3Maybe(Completable source)Converts an 1.x Completable into a 3.x Maybe, composing cancellation (unsubscription) through.static <T> Maybe<T>toV3Maybe(Single<T> source)Converts an 1.x Single into a 3.x Maybe, composing cancellation (unsubscription) through.static <T> Observable<T>toV3Observable(Observable<T> source)Converts an 1.x Observable into a 3.x Observable, cancellation (unsubscription) through.static <T,R>
FlowableOperator<R,T>toV3Operator(Observable.Operator<R,T> operator)Convert the 1.x Observable.Operator into a 3.x FlowableOperator.static <T> FlowableProcessor<T>toV3Processor(Subject<T,T> subject)Wraps a 1.x Subject into a 3.x FlowableProcessor.static SchedulertoV3Scheduler(Scheduler scheduler)static <T> Single<T>toV3Single(Single<T> source)Converts an 1.x Single into a 3.x Single, composing cancellation (unsubscription) through.static <T> Subject<T>toV3Subject(Subject<T,T> subject)Wraps a 1.x Subject into a 3.x Subject.static CompletableTransformertoV3Transformer(Completable.Transformer transformer)Convert the 1.x Completable.Transformer into a 3.x CompletableTransformer.static <T,R>
FlowableTransformer<T,R>toV3Transformer(Observable.Transformer<T,R> transformer)Convert the 1.x Observable.Transformer into a 3.x FlowableTransformer.static <T,R>
ObservableTransformer<T,R>toV3Transformer(Observable.Transformer<T,R> transformer, BackpressureStrategy strategy)Convert the 1.x Observable.Transformer into a 3.x ObservableTransformer.static <T,R>
SingleTransformer<T,R>toV3Transformer(Single.Transformer<T,R> transformer)Convert the 1.x Single.Transformer into a 3.x SingleTransformer.
-
-
-
Method Detail
-
toV3Flowable
@SchedulerSupport("none") public static <T> Flowable<T> toV3Flowable(Observable<T> source)
Converts an 1.x Observable into a 3.x Flowable, composing the backpressure and cancellation (unsubscription) through.Note that in 1.x Observable's backpressure somewhat optional; you may need to apply one of the onBackpressureXXX operators on the source Observable or the resulting Flowable.
- Backpressure:
- The operator doesn't interfere with backpressure which is determined by the
source 1.x
Observable's backpressure behavior. - Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the value type- Parameters:
source- the source 1.x Observable instance, not null- Returns:
- the new 3.x Flowable instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV3Observable
@SchedulerSupport("none") public static <T> Observable<T> toV3Observable(Observable<T> source)
Converts an 1.x Observable into a 3.x Observable, cancellation (unsubscription) through.- Backpressure:
- The operator consumes the source 1.x
Observablein an unbounded manner (without applying backpressure). - Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the value type- Parameters:
source- the source 1.x Observable instance, not null- Returns:
- the new 3.x Observable instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV3Maybe
@SchedulerSupport("none") public static <T> Maybe<T> toV3Maybe(Completable source)
Converts an 1.x Completable into a 3.x Maybe, composing cancellation (unsubscription) through.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the value type- Parameters:
source- the source 1.x Completable instance, not null- Returns:
- the new 3.x Maybe instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV3Maybe
@SchedulerSupport("none") public static <T> Maybe<T> toV3Maybe(Single<T> source)
Converts an 1.x Single into a 3.x Maybe, composing cancellation (unsubscription) through.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the value type- Parameters:
source- the source 1.x Single instance, not null- Returns:
- the new 3.x Maybe instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV3Single
@SchedulerSupport("none") public static <T> Single<T> toV3Single(Single<T> source)
Converts an 1.x Single into a 3.x Single, composing cancellation (unsubscription) through.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the value type- Parameters:
source- the source 1.x Single instance, not null- Returns:
- the new 3.x Single instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV3Completable
@SchedulerSupport("none") public static Completable toV3Completable(Completable source)
Converts an 1.x Completable into a 3.x Completable, composing cancellation (unsubscription) through.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Parameters:
source- the source 1.x Completable instance, not null- Returns:
- the new 3.x Completable instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV3Subject
@SchedulerSupport("none") public static <T> Subject<T> toV3Subject(Subject<T,T> subject)
Wraps a 1.x Subject into a 3.x Subject.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input and output value type of the Subjects- Parameters:
subject- the subject to wrap with the same input and output type; 3.x Subject supports only the same input and output type- Returns:
- the new 3.x Subject instance
- Throws:
java.lang.NullPointerException- ifsourceis null- Since:
- 0.9.0
-
toV3Processor
@SchedulerSupport("none") public static <T> FlowableProcessor<T> toV3Processor(Subject<T,T> subject)
Wraps a 1.x Subject into a 3.x FlowableProcessor.- Backpressure:
- The operator doesn't interfere with backpressure which is determined by the
source 1.x
Subject's backpressure behavior. - Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input and output value type of the Subjects- Parameters:
subject- the subject to wrap with the same input and output type; 3.x FlowableProcessor supports only the same input and output type- Returns:
- the new 3.x FlowableProcessor instance
- Throws:
java.lang.NullPointerException- ifsourceis null- Since:
- 0.9.0
-
toV3Transformer
@SchedulerSupport("none") public static <T,R> FlowableTransformer<T,R> toV3Transformer(Observable.Transformer<T,R> transformer)
Convert the 1.x Observable.Transformer into a 3.x FlowableTransformer.- Backpressure:
- The operator doesn't interfere with backpressure which is determined by the 1.x Observable returned by the 1.x Transformer.
- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input value typeR- the output value type- Parameters:
transformer- the 1.x Observable.Transformer to convert- Returns:
- the new FlowableTransformer instance
- Since:
- 0.9.0
-
toV3Transformer
@SchedulerSupport("none") public static <T,R> ObservableTransformer<T,R> toV3Transformer(Observable.Transformer<T,R> transformer, BackpressureStrategy strategy)
Convert the 1.x Observable.Transformer into a 3.x ObservableTransformer.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input value typeR- the output value type- Parameters:
strategy- the backpressure strategy to apply: BUFFER, DROP or LATEST.transformer- the 1.x Observable.Transformer to convert- Returns:
- the new ObservableTransformer instance
- Since:
- 0.12.0
-
toV3Transformer
@SchedulerSupport("none") public static <T,R> SingleTransformer<T,R> toV3Transformer(Single.Transformer<T,R> transformer)
Convert the 1.x Single.Transformer into a 3.x SingleTransformer.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input value typeR- the output value type- Parameters:
transformer- the 1.x Single.Transformer to convert- Returns:
- the new SingleTransformer instance
- Since:
- 0.9.0
-
toV3Transformer
@SchedulerSupport("none") public static CompletableTransformer toV3Transformer(Completable.Transformer transformer)
Convert the 1.x Completable.Transformer into a 3.x CompletableTransformer.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Parameters:
transformer- the 1.x Completable.Transformer to convert- Returns:
- the new CompletableTransformer instance
- Since:
- 0.9.0
-
toV3Operator
@SchedulerSupport("none") public static <T,R> FlowableOperator<R,T> toV3Operator(Observable.Operator<R,T> operator)
Convert the 1.x Observable.Operator into a 3.x FlowableOperator.- Backpressure:
- The operator doesn't interfere with backpressure which is determined by the 1.x Subscriber returned by the 1.x Operator.
- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input value typeR- the output value type- Parameters:
operator- the 1.x Observable.Operator to convert- Returns:
- the new FlowableOperator instance
- Since:
- 0.9.0
-
toV3Disposable
public static Disposable toV3Disposable(Subscription subscription)
Convert the 1.xSubscriptioninto a 3.xDisposable.- Parameters:
subscription- the 1.x Subscription to convert- Returns:
- the new Disposable instance
- Since:
- 0.11.0
-
toV1Observable
@SchedulerSupport("none") public static <T> Observable<T> toV1Observable(org.reactivestreams.Publisher<T> source)
Converts a Reactive-Streams Publisher of any kind (the base type of 3.x Flowable) into an 1.x Observable, composing the backpressure and cancellation (unsubscription) through.Note that this method can convert any Reactive-Streams compliant source into an 1.x Observable, not just the 3.x Flowable.
- Backpressure:
- The operator doesn't interfere with backpressure which is determined by the
source
Publisher's backpressure behavior. - Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the value type- Parameters:
source- the source Reactive-Streams Publisher instance, not null- Returns:
- the new 1.x Observable instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV1Observable
@SchedulerSupport("none") public static <T> Observable<T> toV1Observable(ObservableSource<T> source, BackpressureStrategy strategy)
Converts a 3.x ObservableSource (the base type of 3.x Observable) into an 1.x Observable instance, applying the specified backpressure strategy and composing the cancellation (unsubscription) through.- Backpressure:
- The operator applies the backpressure strategy you specify.
- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the value type- Parameters:
source- the source ObservableSource instance, not nullstrategy- the backpressure strategy to apply: BUFFER, DROP or LATEST.- Returns:
- the new 1.x Observable instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV1Single
@SchedulerSupport("none") public static <T> Single<T> toV1Single(SingleSource<T> source)
Converts an 3.x SingleSource (the base type of 3.x Single) into a 1.x Single, composing cancellation (unsubscription) through.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the value type- Parameters:
source- the source 3.x SingleSource instance, not null- Returns:
- the new 1.x Single instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV1Completable
@SchedulerSupport("none") public static Completable toV1Completable(CompletableSource source)
Converts an 3.x CompletableSource (the base type of 3.x Completable) into a 1.x Completable, composing cancellation (unsubscription) through.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Parameters:
source- the source 3.x CompletableSource instance, not null- Returns:
- the new 1.x Completable instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV1Single
@SchedulerSupport("none") public static <T> Single<T> toV1Single(MaybeSource<T> source)
Converts an 3.x MaybeSource (the base type of 3.x Maybe) into a 1.x Single, composing cancellation (unsubscription) through and signalling NoSuchElementException if the MaybeSource is empty.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the source's value type- Parameters:
source- the source 3.x MaybeSource instance, not null- Returns:
- the new 1.x Single instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV1Completable
@SchedulerSupport("none") public static <T> Completable toV1Completable(MaybeSource<T> source)
Converts an 3.x MaybeSource (the base type of 3.x Maybe) into a 1.x Completable, composing cancellation (unsubscription) through and ignoring the success value.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the source's value type- Parameters:
source- the source 3.x MaybeSource instance, not null- Returns:
- the new 1.x Completable instance
- Throws:
java.lang.NullPointerException- ifsourceis null
-
toV1Subject
@SchedulerSupport("none") public static <T> Subject<T,T> toV1Subject(Subject<T> subject)
Wraps a 3.x Subject into a 1.x Subject.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input and output value type of the Subjects- Parameters:
subject- the subject to wrap with the same input and output type; 3.x Subject supports only the same input and output type- Returns:
- the new 1.x Subject instance
- Throws:
java.lang.NullPointerException- ifsourceis null- Since:
- 0.9.0
-
toV1Subject
@SchedulerSupport("none") public static <T> Subject<T,T> toV1Subject(FlowableProcessor<T> processor)
Wraps a 3.x FlowableProcessor into a 1.x Subject.- Backpressure:
- The operator doesn't interfere with backpressure which is determined by the
source
FlowableProcessor's backpressure behavior. - Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input and output value type of the Subjects- Parameters:
processor- the flowable-processor to wrap with the same input and output type; 3.x FlowableProcessor supports only the same input and output type- Returns:
- the new 1.x Subject instance
- Throws:
java.lang.NullPointerException- ifsourceis null- Since:
- 0.9.0
-
toV1Transformer
@SchedulerSupport("none") public static <T,R> Observable.Transformer<T,R> toV1Transformer(FlowableTransformer<T,R> transformer)
Convert the 3.x FlowableTransformer into a 1.x Observable.Transformer.- Backpressure:
- The operator doesn't interfere with backpressure which is determined by the 3.x Flowable returned by the 3.x FlowableTransformer.
- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input value typeR- the output value type- Parameters:
transformer- the 3.x FlowableTransformer to convert- Returns:
- the new Observable.Transformer instance
- Since:
- 0.9.0
-
toV1Transformer
@SchedulerSupport("none") public static <T,R> Observable.Transformer<T,R> toV1Transformer(ObservableTransformer<T,R> transformer, BackpressureStrategy strategy)
Convert the 3.x ObservableTransformer into a 1.x Observable.Transformer.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input value typeR- the output value type- Parameters:
transformer- the 3.x ObservableTransformer to convertstrategy- the backpressure strategy to apply: BUFFER, DROP or LATEST.- Returns:
- the new Observable.Transformer instance
- Since:
- 0.12.0
-
toV1Transformer
@SchedulerSupport("none") public static <T,R> Single.Transformer<T,R> toV1Transformer(SingleTransformer<T,R> transformer)
Convert the 3.x SingleTransformer into a 1.x Single.Transformer.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input value typeR- the output value type- Parameters:
transformer- the 3.x SingleTransformer to convert- Returns:
- the new Single.Transformer instance
- Since:
- 0.9.0
-
toV1Transformer
@SchedulerSupport("none") public static Completable.Transformer toV1Transformer(CompletableTransformer transformer)
Convert the 3.x CompletableTransformer into a 1.x Completable.Transformer.- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Parameters:
transformer- the 3.x CompletableTransformer to convert- Returns:
- the new Completable.Transformer instance
- Since:
- 0.9.0
-
toV1Operator
@SchedulerSupport("none") public static <T,R> Observable.Operator<R,T> toV1Operator(FlowableOperator<R,T> operator)
Convert the 3.x FlowableOperator into a 1.x Observable.Operator.- Backpressure:
- The operator doesn't interfere with backpressure which is determined by the 3.x Subscriber returned by the 3.x FlowableOperator.
- Scheduler:
- The method does not operate by default on a particular
Scheduler.
- Type Parameters:
T- the input value typeR- the output value type- Parameters:
operator- the 3.x FlowableOperator to convert- Returns:
- the new Observable.Operator instance
- Since:
- 0.9.0
-
toV1Subscription
public static Subscription toV1Subscription(Disposable disposable)
Convert the 3.xDisposableinto a 1.xSubscription.- Parameters:
disposable- the 3.x Disposable to convert- Returns:
- the new Subscription instance
- Since:
- 0.11.0
-
toV1Scheduler
public static Scheduler toV1Scheduler(Scheduler scheduler)
- Parameters:
scheduler- the 3.x Scheduler to convert- Returns:
- the new 1.x Scheduler instance
- Since:
- 0.12.0
-
-