本文整理了Java中rx.Notification.isOnNext()
方法的一些代码示例,展示了Notification.isOnNext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notification.isOnNext()
方法的具体详情如下:
包路径:rx.Notification
类名称:Notification
方法名:isOnNext
[英]Indicates whether this notification represents an onNext event.
[中]指示此通知是否表示onNext事件。
代码示例来源:origin: PipelineAI/pipeline
if (!current.isOnNext()) {
matchFailed = true;
} else {
代码示例来源:origin: com.netflix.rxjava/rxjava-core
/**
* Indicates whether this notification has an item associated with it.
*
* @return a boolean indicating whether or not this notification has an item associated with it
*/
public boolean hasValue() {
return isOnNext() && value != null;
// isn't "null" a valid item?
}
代码示例来源:origin: com.netflix.rxjava/rxjava-core
@Override
public void onNext(Notification<? extends T> args) {
if (WAITING_UPDATER.getAndSet(this, 0) == 1 || !args.isOnNext()) {
Notification<? extends T> toOffer = args;
while (!buf.offer(toOffer)) {
Notification<? extends T> concurrentItem = buf.poll();
// in case if we won race condition with onComplete/onError method
if (concurrentItem != null && !concurrentItem.isOnNext()) {
toOffer = concurrentItem;
}
}
}
}
代码示例来源:origin: com.netflix.rxjava/rxjava-core
@Override
public T next() {
if (hasNext()) {
if (iNotif.isOnNext()) {
T v = iNotif.getValue();
iNotif = null;
return v;
}
}
throw new NoSuchElementException();
}
代码示例来源:origin: com.netflix.rxjava/rxjava-core
if (nextNotification.isOnNext()) {
isNextConsumed = false;
next = nextNotification.getValue();
代码示例来源:origin: com.github.davidmoten/rxjava-slf4j
@Override
public void call(Message<T> m) {
if (m.value().isOnCompleted() && onCompleteMessage != null) {
StringBuilder s = new StringBuilder();
addDelimited(s, onCompleteMessage);
addDelimited(s, m.message());
addMemory(s);
Logging.log(getLogger(), s.toString(), onCompletedLevel, null);
} else if (m.value().isOnError() && logOnError) {
StringBuilder s = new StringBuilder();
addDelimited(s,
String.format(onErrorFormat, m.value().getThrowable().getMessage()));
addDelimited(s, m.message());
addMemory(s);
Logging.log(getLogger(), s.toString(), onErrorLevel, m.value()
.getThrowable());
} else if (m.value().isOnNext() && logOnNext) {
StringBuilder s = new StringBuilder();
if (onNextFormat.length() > 0)
s.append(String.format(onNextFormat,
String.valueOf(valueFunction.call(m.value().getValue()))));
addDelimited(s, m.message());
addMemory(s);
addStackTrace(s);
Logging.log(getLogger(), s.toString(), onNextLevel, null);
}
}
代码示例来源:origin: davidmoten/rxjava-slf4j
@Override
public void call(Message<T> m) {
if (m.value().isOnCompleted() && onCompleteMessage != null) {
StringBuilder s = new StringBuilder();
addDelimited(s, onCompleteMessage);
addDelimited(s, m.message());
addMemory(s);
Logging.log(getLogger(), s.toString(), onCompletedLevel, null);
} else if (m.value().isOnError() && logOnError) {
StringBuilder s = new StringBuilder();
addDelimited(s,
String.format(onErrorFormat, m.value().getThrowable().getMessage()));
addDelimited(s, m.message());
addMemory(s);
Logging.log(getLogger(), s.toString(), onErrorLevel, m.value()
.getThrowable());
} else if (m.value().isOnNext() && logOnNext) {
StringBuilder s = new StringBuilder();
if (onNextFormat.length() > 0)
s.append(String.format(onNextFormat,
String.valueOf(valueFunction.call(m.value().getValue()))));
addDelimited(s, m.message());
addMemory(s);
addStackTrace(s);
Logging.log(getLogger(), s.toString(), onNextLevel, null);
}
}
代码示例来源:origin: com.netflix.rxjava/rxjava-core
/**
* Forwards this notification on to a specified {@link Observer}.
*/
public void accept(Observer<? super T> observer) {
if (isOnNext()) {
observer.onNext(getValue());
} else if (isOnCompleted()) {
observer.onCompleted();
} else if (isOnError()) {
observer.onError(getThrowable());
}
}
内容来源于网络,如有侵权,请联系作者删除!