本文整理汇总了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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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());
}
}
示例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;
}
示例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();
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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();
}
示例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);
}
}
}
示例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();
}