/** * Retry this Solo indefinitely if it fails. * @return the new Solo instance */ public final Solo<T> retry() { return onAssembly(new SoloRetry<T>(this, Long.MAX_VALUE)); }
/** * Hides the identity of this Solo, including its Subscription and * allows preventing fusion and other optimizations for diagnostic * purposes. * @return the new Solo instance */ public final Solo<T> hide() { return onAssembly(new SoloHide<T>(this)); }
/** * Caches the value or error event of the upstream Solo * and relays/replays it to Subscribers. * @return the new Solo instance * * @since 0.14.1 */ public final Solo<T> cache() { return onAssembly(new SoloCache<T>(this)); }
/** * Defers the creation of the actual Solo to the time when a Subscriber * subscribes to the returned Solo. * @param <T> the value type * @param supplier the supplier of the actual Solo * @return the new Solo instance */ public static <T> Solo<T> defer(Callable<? extends Solo<T>> supplier) { ObjectHelper.requireNonNull(supplier, "supplier is null"); return onAssembly(new SoloDefer<T>(supplier)); }
/** * Wraps a Single into a Solo and signals its events. * @param <T> the value type * @param source the source Single * @return the new Solo instance */ public static <T> Solo<T> fromSingle(SingleSource<T> source) { ObjectHelper.requireNonNull(source, "source is null"); return onAssembly(new SoloFromSingle<T>(source)); }
/** * Emit the events of the Solo that reacts first. * @param <T> the common value type * @param sources the array of Solo sources * @return the new Solo instance */ public static <T> Solo<T> ambArray(Solo<? extends T>... sources) { ObjectHelper.requireNonNull(sources, "sources is null"); return onAssembly(new SoloAmbArray<T>(sources)); }
/** * Maps the Throwable error of this Solo into another Throwable error type. * @param errorMapper the function that receives the Throwable and should * return a Throwable to be emitted. * @return the new Solo instance */ public final Solo<T> mapError(Function<? super Throwable, ? extends Throwable> errorMapper) { ObjectHelper.requireNonNull(errorMapper, "errorMapper is null"); return onAssembly(new SoloMapError<T>(this, errorMapper)); }
/** * Retry this solo if the Publisher returned by the handler signals an item * in response to the failure Throwable. * @param handler the function that receives a Flowable that signals the * failure Throwable of this Solo and returns a Publisher which triggers a retry * or termination. * @return the new Solo instance */ public final Solo<T> retryWhen(Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler) { ObjectHelper.requireNonNull(handler, "handler is null"); return onAssembly(new SoloRetryWhen<T>(this, handler)); }
/** * If the upstream signals an error, switch over to the next Solo * and emits its signal instead. * @param next the other Solo to switch to in case of an upstream error * @return the new Solo instance */ public final Solo<T> onErrorResumeWith(Solo<T> next) { ObjectHelper.requireNonNull(next, "next is null"); return onAssembly(new SoloOnErrorResumeWith<T>(this, next)); }
/** * If the upstream signals an error, call a function and subscribe to * the Solo it returns. * @param errorHandler the function receiving the upstream error and * returns a Solo to resume with. * @return the new Solo instance */ public final Solo<T> onErrorResumeNext(Function<? super Throwable, ? extends Solo<T>> errorHandler) { ObjectHelper.requireNonNull(errorHandler, "errorHandler is null"); return onAssembly(new SoloOnErrorResumeNext<T>(this, errorHandler)); }
/** * Delay the subscription to this Solo until the other Publisher * signals a value or completes. * @param other the other Publisher to trigger the actual subscription * @return the new Solo type */ public final Solo<T> delaySubscription(Publisher<?> other) { ObjectHelper.requireNonNull(other, "other is null"); return onAssembly(new SoloDelaySubscription<T>(this, other)); }
/** * Returns a Solo that signals the given error to Subscribers. * @param <T> the value type * @param error the error to signal, not null * @return the new Solo instance */ public static <T> Solo<T> error(Throwable error) { ObjectHelper.requireNonNull(error, "error is null"); return onAssembly(new SoloError<T>(error)); }
/** * Emit the events of the Solo that reacts first. * @param <T> the common value type * @param sources the Iterable sequence of Solo sources * @return the new Solo instance */ public static <T> Solo<T> amb(Iterable<? extends Solo<? extends T>> sources) { ObjectHelper.requireNonNull(sources, "sources is null"); return onAssembly(new SoloAmbIterable<T>(sources)); }
/** * Maps the value of this Solo into another value via function. * @param <R> the output value type * @param mapper the function that receives the success value of this Solo * and returns a replacement value. * @return the new Solo instance */ public final <R> Solo<R> map(Function<? super T, ? extends R> mapper) { ObjectHelper.requireNonNull(mapper, "mapper is null"); return onAssembly(new SoloMap<T, R>(this, mapper)); }
/** * If the upstream signals an error, signal an item instead. * @param item the item to signal if the upstream fails * @return the new Solo instance */ public final Solo<T> onErrorReturnItem(T item) { ObjectHelper.requireNonNull(item, "item is null"); return onAssembly(new SoloOnErrorReturnItem<T>(this, item)); }
/** * Signal a NoSuchElementException if the other signals before this * Solo signals. * @param other the other Publisher * @return the new Solo instance */ public final Solo<T> takeUntil(Publisher<?> other) { ObjectHelper.requireNonNull(other, "other is null"); return onAssembly(new SoloTakeUntil<T>(this, other)); }
/** * Map the downstream Subscriber into an upstream Subscriber. * @param <R> the downstream value type * @param onLift the function called with the downstream's Subscriber and * should return a Subscriber to be subscribed to this Solo. * @return the new Solo type */ public final <R> Solo<R> lift(Function<Subscriber<? super R>, Subscriber<? super T>> onLift) { ObjectHelper.requireNonNull(onLift, "onLift is null"); return onAssembly(new SoloLift<T, R>(this, onLift)); }
/** * Returns a Solo that subscribes to this Solo on the specified scheduler * and makes sure downstream requests are forwarded there as well. * @param scheduler the scheduler to subscribe on * @return the new Solo instance */ public final Solo<T> subscribeOn(Scheduler scheduler) { ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return onAssembly(new SoloSubscribeOn<T>(this, scheduler)); }
/** * Returns a Solo which when cancelled, cancels this Solo on the * specified scheduler. * @param scheduler the scheduler to cancel this Solo * @return the new Solo instance */ public final Solo<T> unsubscribeOn(Scheduler scheduler) { ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return onAssembly(new SoloUnsubscribeOn<T>(this, scheduler)); }
/** * Run the given Nono after this Solo completes successfully and * emit that original success value only if the Nono completes normally. * @param other the other Nono to execute * @return the new Solo instance */ public final Solo<T> andThen(Nono other) { ObjectHelper.requireNonNull(other, "other is null"); return onAssembly(new SoloAndThen<T>(this, other)); }