本文整理汇总了Java中io.reactivex.CompletableTransformer类的典型用法代码示例。如果您正苦于以下问题:Java CompletableTransformer类的具体用法?Java CompletableTransformer怎么用?Java CompletableTransformer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompletableTransformer类属于io.reactivex包,在下文中一共展示了CompletableTransformer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logCompletable
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
/**
* Creates transform operator, which logs defined events in observable's lifecycle
* @param msg message
* @param bitMask bitmask of events which you want to log
* @return transformer
*/
public static CompletableTransformer logCompletable(final String msg, final int bitMask) {
return upstream -> {
if ((bitMask & LOG_SUBSCRIBE) > 0) {
upstream = upstream.compose(cLogSubscribe(msg));
}
if ((bitMask & LOG_ERROR) > 0) {
upstream = upstream.compose(cLogError(msg));
}
if ((bitMask & LOG_COMPLETE) > 0) {
upstream = upstream.compose(cLogComplete(msg));
}
if ((bitMask & LOG_DISPOSE) > 0) {
upstream = upstream.compose(cLogDispose(msg));
}
return upstream;
};
}
示例2: CompletableUseCase
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
public CompletableUseCase(final UseCaseExecutor useCaseExecutor,
final PostExecutionThread postExecutionThread) {
super(useCaseExecutor, postExecutionThread);
schedulersTransformer = new CompletableTransformer() {
@Override
public Completable apply(Completable completable) {
return completable.subscribeOn(useCaseExecutor.getScheduler())
.observeOn(postExecutionThread.getScheduler());
}
};
}
示例3: getSchedulersTransformer
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
private CompletableTransformer getSchedulersTransformer() {
return schedulersTransformer;
}
示例4: cLogError
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
private static CompletableTransformer cLogError(final String msg) {
final Function<Throwable, String> message = e -> e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName();
return upstream -> upstream.doOnError(e -> Timber.e("[onError] %s - %s", msg, message.apply(e)));
}
示例5: cLogComplete
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
private static CompletableTransformer cLogComplete(final String msg) {
return upstream -> upstream.doOnComplete(() -> Timber.v("[onComplete] %s [Thread:%s]", msg, Thread.currentThread().getName()));
}
示例6: cLogSubscribe
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
private static CompletableTransformer cLogSubscribe(final String msg) {
return upstream -> upstream.doOnSubscribe(disposable -> Timber.v("[subscribe] %s [Thread:%s]", msg, Thread.currentThread().getName()));
}
示例7: cLogDispose
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
private static CompletableTransformer cLogDispose(final String msg) {
return upstream -> upstream.doOnDispose(() -> Timber.v("[dispose] %s", msg));
}
示例8: applySchedulersToCompletable
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
public CompletableTransformer applySchedulersToCompletable() {
return completable -> completable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
示例9: applyCompletableIOToMainSchedulers
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
public static CompletableTransformer applyCompletableIOToMainSchedulers() {
return completable -> completable.subscribeOn(Schedulers.io())
.observeOn(Injection.provideMainThreadScheduler());
}
示例10: delayCompletable
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
@Nonnull
@CheckReturnValue
public static CompletableTransformer delayCompletable(@Nonnull Observable<Boolean> pauseLifecycle) {
Preconditions.checkNotNull(pauseLifecycle, "pauseLifecycle == null");
return new DelayCompletableTransformer(pauseLifecycle);
}
示例11: applyCompletableServiceTransformation
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
@CheckResult
@NonNull
@Override
public CompletableTransformer applyCompletableServiceTransformation() {
return applyCompletableIoSchedulers();
}
示例12: applyCompletableSchedulers
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
public static CompletableTransformer applyCompletableSchedulers() {
return upstream -> upstream.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
示例13: forCompletable
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
public CompletableTransformer forCompletable() {
return completable -> completable
.subscribeOn(executor)
.observeOn(notifier);
}
示例14: applyCompletableServiceTransformation
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
/**
* Provides the service {@link Completable} transformation.
* It could be used to sign out the user when getting a service error for example.
*
* @return The {@link Completable} transformation
*/
@CheckResult
@NonNull
CompletableTransformer applyCompletableServiceTransformation();
示例15: applyCompletableIoSchedulers
import io.reactivex.CompletableTransformer; //导入依赖的package包/类
/**
* Provides the Io schedule {@link Completable} transformation.
* Subscribes the stream to Io bound {@link Schedulers} and observes it in the {Android main thread.
*
* @return The stream with the schedule transformation
*/
@CheckResult
@NonNull
protected CompletableTransformer applyCompletableIoSchedulers() {
return completableIoTransformer;
}