rx.Notification.hasThrowable()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中rx.Notification.hasThrowable()方法的一些代码示例,展示了Notification.hasThrowable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notification.hasThrowable()方法的具体详情如下:
包路径:rx.Notification
类名称:Notification
方法名:hasThrowable

Notification.hasThrowable介绍

[英]Indicates whether this notification has an exception associated with it.
[中]指示此通知是否有关联的异常。

代码示例

代码示例来源:origin: com.novoda/rxmocks

@Override
public boolean matches(Notification<T> actual) {
  return actual.hasThrowable() && actual.getThrowable().getClass().isAssignableFrom(errorClazz);
}

代码示例来源:origin: com.netflix.rxjava/rxjava-core

@Override
public String toString() {
  StringBuilder str = new StringBuilder("[").append(super.toString()).append(" ").append(getKind());
  if (hasValue())
    str.append(" ").append(getValue());
  if (hasThrowable())
    str.append(" ").append(getThrowable().getMessage());
  str.append("]");
  return str.toString();
}

代码示例来源:origin: com.netflix.rxjava/rxjava-core

@Override
public int hashCode() {
  int hash = getKind().hashCode();
  if (hasValue())
    hash = hash * 31 + getValue().hashCode();
  if (hasThrowable())
    hash = hash * 31 + getThrowable().hashCode();
  return hash;
}

代码示例来源:origin: com.netflix.rxjava/rxjava-core

@Override
  public boolean equals(Object obj) {
    if (obj == null)
      return false;
    if (this == obj)
      return true;
    if (obj.getClass() != getClass())
      return false;
    Notification<?> notification = (Notification<?>) obj;
    if (notification.getKind() != getKind())
      return false;
    if (hasValue() && !getValue().equals(notification.getValue()))
      return false;
    if (hasThrowable() && !getThrowable().equals(notification.getThrowable()))
      return false;
    return true;
  }
}

相关文章