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


Java ObjectHelper类代码示例

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


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

示例1: subscribeActual

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
protected void subscribeActual(CompletableObserver s) {
    CompletableObserver observer;
    try {
        observer = ObjectHelper.requireNonNull(s, "Null Observer");
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        // can't call onError because no way to know if a Disposable has been set or not
        // can't call onSubscribe because the call might have set a Disposable already
        RxJavaPlugins.onError(e);

        NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
        npe.initCause(e);
        throw npe;
    }

    source.subscribe(new AttachCompletableObserver(observer, this.compositeDisposable));
}
 
开发者ID:cp949,项目名称:DisposableAttach,代码行数:19,代码来源:AttachDisposableCompletable.java

示例2: subscribeActual

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
protected void subscribeActual(Subscriber<? super T> s) {

    Subscriber<? super T> subscriber;
    try {
        subscriber = ObjectHelper.requireNonNull(s, "Null Observer");
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        // can't call onError because no way to know if a Disposable has been set or not
        // can't call onSubscribe because the call might have set a Disposable already
        RxJavaPlugins.onError(e);

        NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
        npe.initCause(e);
        throw npe;
    }

    source.subscribe(new AttachSingleObserver<>(subscriber, this.compositeDisposable));
}
 
开发者ID:cp949,项目名称:DisposableAttach,代码行数:20,代码来源:AttachDisposableFlowable.java

示例3: subscribeActual

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public void subscribeActual(Observer<? super T> s) {
    Observer<? super T> observer;
    try {
        observer = ObjectHelper.requireNonNull(s, "Null Observer");
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        // can't call onError because no way to know if a Disposable has been set or not
        // can't call onSubscribe because the call might have set a Disposable already
        RxJavaPlugins.onError(e);

        NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
        npe.initCause(e);
        throw npe;
    }

    source.subscribe(new AttachSingleObserver<>(observer, this.compositeDisposable));
}
 
开发者ID:cp949,项目名称:DisposableAttach,代码行数:19,代码来源:AttachDisposableObservable.java

示例4: subscribeActual

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
protected void subscribeActual(MaybeObserver<? super T> s) {
    MaybeObserver<? super T> observer;
    try {
        observer = ObjectHelper.requireNonNull(s, "Null Observer");
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        // can't call onError because no way to know if a Disposable has been set or not
        // can't call onSubscribe because the call might have set a Disposable already
        RxJavaPlugins.onError(e);

        NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
        npe.initCause(e);
        throw npe;
    }

    source.subscribe(new AttachMaybeObserver<>(observer, this.compositeDisposable));
}
 
开发者ID:cp949,项目名称:DisposableAttach,代码行数:19,代码来源:AttachDisposableMaybe.java

示例5: subscribeActual

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
protected void subscribeActual(SingleObserver<? super T> s) {
    SingleObserver<? super T> observer;
    try {
        observer = ObjectHelper.requireNonNull(s, "Null Observer");
    } catch (Throwable e) {
        Exceptions.throwIfFatal(e);
        // can't call onError because no way to know if a Disposable has been set or not
        // can't call onSubscribe because the call might have set a Disposable already
        RxJavaPlugins.onError(e);

        NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
        npe.initCause(e);
        throw npe;
    }

    source.subscribe(new AttachSingleObserver<>(observer, this.compositeDisposable));
}
 
开发者ID:cp949,项目名称:DisposableAttach,代码行数:19,代码来源:AttachDisposableSingle.java

示例6: onNext

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public void onNext(T t) {
    if (done) {
        return;
    }

    if (sourceMode == ASYNC) {
        actual.onNext(null);
        return;
    }

    Optional<R> o;

    try {
        o = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null Optional");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        fail(ex);
        return;
    }

    if (o.isPresent()) {
        actual.onNext(o.get());
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Jdk8Interop,代码行数:26,代码来源:ObservableMapOptional.java

示例7: tryOnNext

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public boolean tryOnNext(T t) {
    if (done) {
        return false;
    }

    if (sourceMode == ASYNC) {
        return actual.tryOnNext(null);
    }

    Optional<R> o;

    try {
        o = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null Optional");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        fail(ex);
        return false;
    }

    if (o.isPresent()) {
        return actual.tryOnNext(o.get());
    }
    return false;
}
 
开发者ID:akarnokd,项目名称:RxJava2Jdk8Interop,代码行数:26,代码来源:FlowableMapOptional.java

示例8: onSuccess

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public void onSuccess(T value) {
    Optional<R> v;
    
    try {
        v = ObjectHelper.requireNonNull(mapper.apply(value), "The mapper returned a null Optional");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        actual.onError(ex);
        return;
    }
    
    if (v.isPresent()) {
        actual.onSuccess(v.get());
    } else {
        actual.onComplete();
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Jdk8Interop,代码行数:19,代码来源:MaybeMapOptional.java

示例9: forEach

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
/**
 * The given consumer is invoked with each registered handler instance.
 * <p>
 * Exceptions raised by the invocation of the consumer for a particular
 * handler are printed to the console and the current thread's
 * uncaught exception handler is notified.
 * <p>
 * This method is threadsafe.
 * @param consumer the consumer to invoke
 */
public final void forEach(@NonNull Consumer<H> consumer) {
    ObjectHelper.requireNonNull(consumer, "consumer is null");
    Iterator<HandlerRegistration<H>> it = handlers.iterator();
    while (it.hasNext()) {
        try {
            HandlerRegistration<H> hr = it.next();
            H h = hr.get();
            if (h != null) {
                consumer.accept(h);
            }
        } catch (Throwable ex) {
            ex.printStackTrace();
            Thread t = Thread.currentThread();
            t.getUncaughtExceptionHandler().uncaughtException(t, ex);
        }
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:28,代码来源:MultiHandlerManager.java

示例10: onNext

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public void onNext(T t) {
    Publisher<? extends R> p;
    try {
        p = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null Publisher");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        s.cancel();
        onError(ex);
        return;
    }

    SfmInnerSubscriber<T, R> inner = new SfmInnerSubscriber<T, R>(this, bufferSize);
    if (add(inner)) {
        p.subscribe(inner);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:18,代码来源:FlowableSwitchFlatMap.java

示例11: fastpath

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
void fastpath() {
    Callable<T> c = callable;
    for (;;) {
        if (cancelled) {
            break;
        }

        T v;

        try {
            v = ObjectHelper.requireNonNull(c.call(), "The callable returned a null value");
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            actual.onError(ex);
            break;
        }

        actual.onNext(v);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:21,代码来源:FlowableRepeatCallable.java

示例12: onNext

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public void onNext(T t) {
    produced++;
    actual.onNext(t);

    Publisher<? extends T> p;
    try {
        p = ObjectHelper.requireNonNull(expander.apply(t), "The expander returned a null Publisher");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        super.cancel();
        actual.onError(ex);
        drainQueue();
        return;
    }

    queue.offer(p);
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:19,代码来源:FlowableExpand.java

示例13: subscribeActual

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
protected void subscribeActual(Subscriber<? super Void> s) {
    Iterator<? extends Nono> it;

    try {
        it = ObjectHelper.requireNonNull(sources.iterator(), "The sources Iterable returned a null Iterator");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    ConcatSubscriber parent = new ConcatSubscriber(s, it, delayError);
    s.onSubscribe(parent);
    parent.drain();
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:17,代码来源:NonoConcatIterable.java

示例14: onNext

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public void onNext(T t) {
    if (!done) {
        if (sourceMode == NONE) {
            R v;

            try {
                v = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null value");
            } catch (Throwable ex) {
                fail(ex);
                return;
            }

            actual.onNext(v);
        } else {
            actual.onNext(null);
        }
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:20,代码来源:SoloMap.java

示例15: subscribeActual

import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
protected void subscribeActual(Subscriber<? super T> s) {
    FlowableProcessor<Throwable> pp = PublishProcessor.<Throwable>create().toSerialized();

    Publisher<?> when;
    try {
        when = ObjectHelper.requireNonNull(handler.apply(pp), "The handler returned a null Publisher");
    } catch (Throwable ex) {
        Exceptions.throwIfFatal(ex);
        EmptySubscription.error(ex, s);
        return;
    }

    RetrySubscriber<T> parent = new RetrySubscriber<T>(s, pp, source);
    s.onSubscribe(parent);

    when.subscribe(parent.other);
    parent.subscribeNext();
}
 
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:20,代码来源:SoloRetryWhen.java


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