23
23
public class Notification <T > {
24
24
25
25
private final Kind kind ;
26
- private final Exception exception ;
26
+ private final Throwable throwable ;
27
27
private final T value ;
28
28
29
29
/**
@@ -34,7 +34,7 @@ public class Notification<T> {
34
34
*/
35
35
public Notification (T value ) {
36
36
this .value = value ;
37
- this .exception = null ;
37
+ this .throwable = null ;
38
38
this .kind = Kind .OnNext ;
39
39
}
40
40
@@ -44,8 +44,8 @@ public Notification(T value) {
44
44
* @param exception
45
45
* The exception passed to the onError notification.
46
46
*/
47
- public Notification (Exception exception ) {
48
- this .exception = exception ;
47
+ public Notification (Throwable exception ) {
48
+ this .throwable = exception ;
49
49
this .value = null ;
50
50
this .kind = Kind .OnError ;
51
51
}
@@ -54,18 +54,18 @@ public Notification(Exception exception) {
54
54
* A constructor used to represent an onCompleted notification.
55
55
*/
56
56
public Notification () {
57
- this .exception = null ;
57
+ this .throwable = null ;
58
58
this .value = null ;
59
59
this .kind = Kind .OnCompleted ;
60
60
}
61
61
62
62
/**
63
63
* Retrieves the exception associated with an onError notification.
64
64
*
65
- * @return The exception associated with an onError notification.
65
+ * @return Throwable associated with an onError notification.
66
66
*/
67
- public Exception getException () {
68
- return exception ;
67
+ public Throwable getThrowable () {
68
+ return throwable ;
69
69
}
70
70
71
71
/**
@@ -91,8 +91,8 @@ public boolean hasValue() {
91
91
*
92
92
* @return a value indicating whether this notification has an exception.
93
93
*/
94
- public boolean hasException () {
95
- return isOnError () && exception != null ;
94
+ public boolean hasThrowable () {
95
+ return isOnError () && throwable != null ;
96
96
}
97
97
98
98
/**
@@ -125,8 +125,8 @@ public String toString() {
125
125
StringBuilder str = new StringBuilder ("[" ).append (super .toString ()).append (" " ).append (getKind ());
126
126
if (hasValue ())
127
127
str .append (" " ).append (getValue ());
128
- if (hasException ())
129
- str .append (" " ).append (getException ().getMessage ());
128
+ if (hasThrowable ())
129
+ str .append (" " ).append (getThrowable ().getMessage ());
130
130
str .append ("]" );
131
131
return str .toString ();
132
132
}
@@ -136,8 +136,8 @@ public int hashCode() {
136
136
int hash = getKind ().hashCode ();
137
137
if (hasValue ())
138
138
hash = hash * 31 + getValue ().hashCode ();
139
- if (hasException ())
140
- hash = hash * 31 + getException ().hashCode ();
139
+ if (hasThrowable ())
140
+ hash = hash * 31 + getThrowable ().hashCode ();
141
141
return hash ;
142
142
}
143
143
@@ -154,7 +154,7 @@ public boolean equals(Object obj) {
154
154
return false ;
155
155
if (hasValue () && !getValue ().equals (notification .getValue ()))
156
156
return false ;
157
- if (hasException () && !getException ().equals (notification .getException ()))
157
+ if (hasThrowable () && !getThrowable ().equals (notification .getThrowable ()))
158
158
return false ;
159
159
return true ;
160
160
}
0 commit comments