-
- All Implemented Interfaces:
-
com.tds.common.reactor.Observable.Operator
,com.tds.common.reactor.functions.Func1
,com.tds.common.reactor.functions.Function
public final class OperatorOnErrorResumeNextViaFunction<T> implements Observable.Operator<T, T>
Instruct an Observable to pass control to another Observable (the return value of a function) rather than invoking
{@code onError}
if it encounters an error.By default, when an Observable encounters an error that prevents it from emitting the expected item to its Observer, the Observable invokes its Observer's
{@code onError}
method, and then quits without invoking any more of its Observer's methods. The{@code onErrorResumeNext}
operation changes this behavior. If you pass a function that returns an Observable ({@code resumeFunction}
) to{@code onErrorResumeNext}
, if the source Observable encounters an error, instead of invoking its Observer's{@code onError}
method, it will instead relinquish control to this new Observable, which will invoke the Observer's{@code onNext}
method if it is able to do so. In such a case, because no Observable necessarily invokes{@code onError}
, the Observer may never know that an error happened.You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.
-
-
Constructor Summary
Constructors Constructor Description OperatorOnErrorResumeNextViaFunction(Func1<out Object, out Observable<out T>> f)
-
Method Summary
Modifier and Type Method Description static <T> OperatorOnErrorResumeNextViaFunction<T>
withSingle(Func1<out Object, out T> resumeFunction)
static <T> OperatorOnErrorResumeNextViaFunction<T>
withOther(Observable<out T> other)
static <T> OperatorOnErrorResumeNextViaFunction<T>
withException(Observable<out T> other)
Subscriber<out Object>
call(Subscriber<out Object> child)
-
-
Constructor Detail
-
OperatorOnErrorResumeNextViaFunction
OperatorOnErrorResumeNextViaFunction(Func1<out Object, out Observable<out T>> f)
-
-
Method Detail
-
withSingle
static <T> OperatorOnErrorResumeNextViaFunction<T> withSingle(Func1<out Object, out T> resumeFunction)
-
withOther
static <T> OperatorOnErrorResumeNextViaFunction<T> withOther(Observable<out T> other)
-
withException
static <T> OperatorOnErrorResumeNextViaFunction<T> withException(Observable<out T> other)
-
call
Subscriber<out Object> call(Subscriber<out Object> child)
-
-
-
-