本文整理汇总了Java中io.reactivex.internal.functions.ObjectHelper类的典型用法代码示例。如果您正苦于以下问题:Java ObjectHelper类的具体用法?Java ObjectHelper怎么用?Java ObjectHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectHelper类属于io.reactivex.internal.functions包,在下文中一共展示了ObjectHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: onSuccess
import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
void onSuccess(int index, T value) {
values[index] = value;
if (wip.decrementAndGet() == 0) {
R v;
try {
v = ObjectHelper.requireNonNull(zipper.apply(values), "The zipper returned a null value");
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
Arrays.fill(values, null);
actual.onError(ex);
return;
}
Arrays.fill(values, null);
complete(v);
}
}
开发者ID:akarnokd,项目名称:RxJava2Extensions,代码行数:18,代码来源:SoloZipArray.java
示例17: onNext
import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public void onNext(In t) {
if (done) {
return;
}
if (!createdState()) {
return;
}
if (--count == 0) {
requestsArrived = true;
count = requestBatchSize;
}
try {
drainCalled = false;
state = ObjectHelper.requireNonNull(transition.apply(state, t, this),
"intermediate state cannot be null");
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
onError(e);
return;
}
if (!drainCalled) {
drain();
}
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:26,代码来源:FlowableStateMachine.java
示例18: createdState
import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
private boolean createdState() {
if (state == null) {
try {
state = ObjectHelper.requireNonNull(initialState.call(),
"initial state cannot be null");
return true;
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
done = true;
onError_(e);
return false;
}
} else {
return true;
}
}
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:17,代码来源:FlowableStateMachine.java
示例19: onNext
import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@Override
public void onNext(T t) {
if (done) {
ResourceFlowable.releaseItem(t, release);
} else {
R v;
try {
v = ObjectHelper.requireNonNull(mapper.apply(t), "The mapper returned a null value");
} catch (Throwable ex) {
Exceptions.throwIfFatal(ex);
upstream.cancel();
ResourceFlowable.releaseItem(t, release);
done = true;
actual.onError(ex);
return;
}
ResourceFlowable.releaseItem(t, release);
actual.onNext(v);
}
}
开发者ID:akarnokd,项目名称:akarnokd-misc,代码行数:24,代码来源:ResourceFlowableToFlowable.java
示例20: actions
import io.reactivex.internal.functions.ObjectHelper; //导入依赖的package包/类
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static Observable<ActionEvent> actions(@NonNull AbstractButton button) {
ObjectHelper.requireNonNull(button, "button is null");
return RxSwingPlugins.onAssembly(new ActionEventObservable(button));
}
开发者ID:akarnokd,项目名称:RxJava2Swing,代码行数:8,代码来源:SwingObservable.java
注:本文中的io.reactivex.internal.functions.ObjectHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论