当前位置: 首页>>代码示例>>Java>>正文


Java MaybeTransformer类代码示例

本文整理汇总了Java中io.reactivex.MaybeTransformer的典型用法代码示例。如果您正苦于以下问题:Java MaybeTransformer类的具体用法?Java MaybeTransformer怎么用?Java MaybeTransformer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MaybeTransformer类属于io.reactivex包,在下文中一共展示了MaybeTransformer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: logMaybe

import io.reactivex.MaybeTransformer; //导入依赖的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
 * @param <T>     type
 * @return transformer
 */
public static <T> MaybeTransformer<T, T> logMaybe(final String msg, final int bitMask) {
    return upstream -> {
        if ((bitMask & LOG_SUBSCRIBE) > 0) {
            upstream = upstream.compose(mLogSubscribe(msg));
        }
        if ((bitMask & LOG_ERROR) > 0) {
            upstream = upstream.compose(mLogError(msg));
        }
        if ((bitMask & LOG_NEXT_DATA) > 0) {
            upstream = upstream.compose(mLogSuccess(msg));
        } else if ((bitMask & LOG_NEXT_EVENT) > 0) {
            upstream = upstream.compose(mLogSuccessEvent(msg));
        }
        if ((bitMask & LOG_COMPLETE) > 0) {
            upstream = upstream.compose(mLogComplete(msg));
        }
        if ((bitMask & LOG_DISPOSE) > 0) {
            upstream = upstream.compose(mLogDispose(msg));
        }
        return upstream;
    };
}
 
开发者ID:Team-SOFTsk,项目名称:RxLog,代码行数:30,代码来源:RxLog.java

示例2: applyMaybeIoSchedulers

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
/**
 * Provides the Io schedule {@link Maybe} 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 <T> MaybeTransformer<T, T> applyMaybeIoSchedulers() {
  //noinspection unchecked
  return (MaybeTransformer<T, T>) maybeIoTransformer;
}
 
开发者ID:xmartlabs,项目名称:bigbang,代码行数:13,代码来源:Controller.java

示例3: MaybeUseCase

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
public MaybeUseCase(final UseCaseExecutor useCaseExecutor,
                    final PostExecutionThread postExecutionThread) {
    super(useCaseExecutor, postExecutionThread);
    schedulersTransformer = new MaybeTransformer<R, R>() {
        @Override
        public Maybe<R> apply(Maybe<R> single) {
            return single.subscribeOn(useCaseExecutor.getScheduler())
                    .observeOn(postExecutionThread.getScheduler());
        }
    };
}
 
开发者ID:6thsolution,项目名称:EasyMVP,代码行数:12,代码来源:MaybeUseCase.java

示例4: applyMaybe

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
public static <T> MaybeTransformer<T, T> applyMaybe(LifecycleOwner lifecycleOwner) {
    return maybe -> {
        LiveData<T> liveData = LiveDataReactiveStreams.fromPublisher(maybe.toFlowable());
        return Flowable.fromPublisher(LiveDataReactiveStreams
                .toPublisher(lifecycleOwner, liveData)).firstElement();
    };
}
 
开发者ID:Zeyad-37,项目名称:UseCases,代码行数:8,代码来源:LifecycleRxJavaBinder.java

示例5: mLogSuccess

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
private static <T> MaybeTransformer<T, T> mLogSuccess(final String msg) {
    return upstream -> upstream.doOnSuccess(data -> Timber.d("[onSuccess] %s %s [Thread:%s]", msg, data, Thread.currentThread().getName()));
}
 
开发者ID:Team-SOFTsk,项目名称:RxLog,代码行数:4,代码来源:RxLog.java

示例6: mLogSuccessEvent

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
private static <T> MaybeTransformer<T, T> mLogSuccessEvent(final String msg) {
    return upstream -> upstream.doOnSuccess(x -> Timber.d("[onSuccess] %s [Thread:%s]", msg, Thread.currentThread().getName()));
}
 
开发者ID:Team-SOFTsk,项目名称:RxLog,代码行数:4,代码来源:RxLog.java

示例7: mLogError

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
private static <T> MaybeTransformer<T, T> mLogError(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)));
}
 
开发者ID:Team-SOFTsk,项目名称:RxLog,代码行数:5,代码来源:RxLog.java

示例8: mLogComplete

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
private static <T> MaybeTransformer<T, T> mLogComplete(final String msg) {
    return upstream -> upstream.doOnComplete(() -> Timber.v("[onComplete] %s [Thread:%s]", msg, Thread.currentThread().getName()));
}
 
开发者ID:Team-SOFTsk,项目名称:RxLog,代码行数:4,代码来源:RxLog.java

示例9: mLogSubscribe

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
private static <T> MaybeTransformer<T, T> mLogSubscribe(final String msg) {
    return upstream -> upstream.doOnSubscribe(disposable -> Timber.v("[subscribe] %s [Thread:%s]", msg, Thread.currentThread().getName()));
}
 
开发者ID:Team-SOFTsk,项目名称:RxLog,代码行数:4,代码来源:RxLog.java

示例10: mLogDispose

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
private static <T> MaybeTransformer<T, T> mLogDispose(final String msg) {
    return upstream -> upstream.doOnDispose(() -> Timber.v("[dispose] %s", msg));
}
 
开发者ID:Team-SOFTsk,项目名称:RxLog,代码行数:4,代码来源:RxLog.java

示例11: applyMaybeIOToMainSchedulers

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
public static <T> MaybeTransformer<T, T> applyMaybeIOToMainSchedulers() {
    return upstream -> upstream
            .subscribeOn(Schedulers.io())
            .observeOn(Injection.provideMainThreadScheduler());
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:6,代码来源:RxUtils.java

示例12: bind

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
public static <T> MaybeTransformer<T, T> bind(@NonNull LifecycleOwner lifecycleOwner,
                                              @NonNull MaybeObserver<T> observer) {
    return new LifecycleTransformer<>(lifecycleOwner, new MaybeWithObserver<>(observer));
}
 
开发者ID:WaylonBrown,项目名称:LifecycleAwareRx,代码行数:5,代码来源:LifecycleBinder.java

示例13: getSchedulersTransformer

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
private MaybeTransformer<? super R, ? extends R> getSchedulersTransformer() {
    return schedulersTransformer;
}
 
开发者ID:6thsolution,项目名称:EasyMVP,代码行数:4,代码来源:MaybeUseCase.java

示例14: forMaybe

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
public <T> MaybeTransformer<T, T> forMaybe() {
    return maybe -> maybe
            .subscribeOn(executor)
            .observeOn(notifier);
}
 
开发者ID:tasomaniac,项目名称:OpenLinkWith,代码行数:6,代码来源:SchedulingStrategy.java

示例15: unmarshaller

import io.reactivex.MaybeTransformer; //导入依赖的package包/类
public static <T> MaybeTransformer<Buffer, T> unmarshaller(Class<T> mappedType) {
  return new MaybeUnmarshaller<>(java.util.function.Function.identity(), mappedType);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:4,代码来源:MaybeHelper.java


注:本文中的io.reactivex.MaybeTransformer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。