2323/**
2424 * For use in internal operators that need something like materialize and dematerialize wholly within the
2525 * implementation of the operator but don't want to incur the allocation cost of actually creating
26- * {@link rx.Notification} objects for every {@code onNext} and {@code onComplete}.
27- *
26+ * {@link rx.Notification} objects for every {@link Observer#onNext onNext} and
27+ * {@link Observer#onCompleted onCompleted}.
28+ * <p>
2829 * An object is allocated inside {@link #error(Throwable)} to wrap the {@link Throwable} but this shouldn't
2930 * affect performance because exceptions should be exceptionally rare.
30- *
31+ * <p>
3132 * It's implemented as a singleton to maintain some semblance of type safety that is completely non-existent.
3233 *
3334 * @param <T>
34- * @warn type param <T> undescribed
35+ * @warn type param undescribed
3536 */
3637public final class NotificationLite <T > {
3738 private NotificationLite () {
@@ -41,7 +42,9 @@ private NotificationLite() {
4142 private static final NotificationLite INSTANCE = new NotificationLite ();
4243
4344 /**
44- * @warn instance() undocumented
45+ * Gets the {@code NotificationLite} singleton.
46+ *
47+ * @return the sole {@code NotificationLite} object
4548 */
4649 @ SuppressWarnings ("unchecked" )
4750 public static <T > NotificationLite <T > instance () {
@@ -70,8 +73,8 @@ public OnErrorSentinel(Throwable e) {
7073 * be unwrapped and sent with the {@link #accept} method.
7174 *
7275 * @param t
73- * @warn parameter "t" undescribed
74- * @return the value or a null token
76+ * the item emitted to {@code onNext}
77+ * @return the item, or a null token representing the item if the item is {@code null}
7578 */
7679 public Object next (T t ) {
7780 if (t == null )
@@ -81,23 +84,22 @@ public Object next(T t) {
8184 }
8285
8386 /**
84- * Creates a lite {@code onComplete } notification without doing any allocation. Can be unwrapped and
87+ * Creates a lite {@code onCompleted } notification without doing any allocation. Can be unwrapped and
8588 * sent with the {@link #accept} method.
8689 *
87- * @return the completion token
90+ * @return a completion token
8891 */
8992 public Object completed () {
9093 return ON_COMPLETED_SENTINEL ;
9194 }
9295
9396 /**
94- * Create a lite {@code onError} notification. This call does new up an object to wrap the {@link Throwable}
95- * but since there should only be one of these the performance impact should be small. Can be unwrapped and
97+ * Create a lite {@code onError} notification. This call creates an object to wrap the {@link Throwable},
98+ * but since there should only be one of these, the performance impact should be small. Can be unwrapped and
9699 * sent with the {@link #accept} method.
97100 *
98- * @warn description doesn't parse in English ("This call does new up an object...")
99101 * @param e
100- * @warn parameter "e" undescribed
102+ * the {@code Throwable} in the {@code onError} notification
101103 * @return an object encapsulating the exception
102104 */
103105 public Object error (Throwable e ) {
@@ -108,10 +110,10 @@ public Object error(Throwable e) {
108110 * Unwraps the lite notification and calls the appropriate method on the {@link Observer}.
109111 *
110112 * @param o
111- * the {@link Observer} to call onNext, onCompleted, or onError.
112- * @warn parameter "n" undescribed
113+ * the {@link Observer} to call {@code onNext}, {@code onCompleted}, or {@code onError}.
113114 * @param n
114- * @return true if {@code n} was a termination event
115+ * the lite notification
116+ * @return {@code true} if {@code n} represents a termination event; {@code false} otherwise
115117 * @throws IllegalArgumentException
116118 * if the notification is null.
117119 * @throws NullPointerException
@@ -138,28 +140,38 @@ public boolean accept(Observer<? super T> o, Object n) {
138140 }
139141
140142 /**
141- * @warn isCompleted() undocumented
143+ * Indicates whether or not the lite notification represents an {@code onCompleted} event.
144+ *
145+ * @param n
146+ * the lite notification
147+ * @return {@code true} if {@code n} represents an {@code onCompleted} event; {@code false} otherwise
142148 */
143149 public boolean isCompleted (Object n ) {
144150 return n == ON_COMPLETED_SENTINEL ;
145151 }
146152
147153 /**
148- * @warn isError() undocumented
154+ * Indicates whether or not the lite notification represents an {@code onError} event.
155+ *
156+ * @param n
157+ * the lite notification
158+ * @return {@code true} if {@code n} represents an {@code onError} event; {@code false} otherwise
149159 */
150160 public boolean isError (Object n ) {
151161 return n instanceof OnErrorSentinel ;
152162 }
153163
154164 /**
155- * If there is custom logic that isn't as simple as call the right method on an {@link Observer} then this
156- * method can be used to get the {@link rx.Notification.Kind}.
165+ * Indicates which variety a particular lite notification is. If you need something more complex than
166+ * simply calling the right method on an {@link Observer} then you can use this method to get the
167+ * {@link rx.Notification.Kind}.
157168 *
158169 * @param n
159- * @warn parameter "n" undescribed
170+ * the lite notification
160171 * @throws IllegalArgumentException
161172 * if the notification is null.
162- * @return the kind of the raw object
173+ * @return the {@link Kind} of lite notification {@code n} is: either {@code Kind.OnCompleted},
174+ * {@code Kind.OnError}, or {@code Kind.OnNext}
163175 */
164176 public Kind kind (Object n ) {
165177 if (n == null )
@@ -174,12 +186,12 @@ else if (n instanceof OnErrorSentinel)
174186 }
175187
176188 /**
177- * Returns the value passed in {@link #next(Object)} method call . Bad things happen if you call this
178- * the {@code onComplete } or {@code onError } notification type. For performance you are expected to use this
179- * when it is appropriate .
189+ * Returns the item corresponding to this {@code OnNext} lite notification . Bad things happen if you pass
190+ * this an {@code OnComplete } or {@code OnError } notification type. For performance reasons, this method
191+ * does not check for this, so you are expected to prevent such a mishap .
180192 *
181193 * @param n
182- * @warn parameter "n" undescribed
194+ * the lite notification (of type {@code Kind.OnNext})
183195 * @return the unwrapped value, which can be null
184196 */
185197 @ SuppressWarnings ("unchecked" )
@@ -188,13 +200,13 @@ public T getValue(Object n) {
188200 }
189201
190202 /**
191- * Returns the {@link Throwable} passed to the {@link #error(Throwable)} method call . Bad things happen if
192- * you call this on the {@code onComplete } or {@code onNext } notification type. For performance you are
193- * expected to use this when it is appropriate .
203+ * Returns the {@link Throwable} corresponding to this {@code OnError} lite notification . Bad things happen
204+ * if you pass this an {@code OnComplete } or {@code OnNext } notification type. For performance reasons, this
205+ * method does not check for this, so you are expected to prevent such a mishap .
194206 *
195207 * @param n
196- * @warn parameter "n" undescribed
197- * @return the {@link Throwable} wrapped inside n
208+ * the lite notification (of type {@code Kind.OnError})
209+ * @return the {@link Throwable} wrapped inside {@code n}
198210 */
199211 public Throwable getError (Object n ) {
200212 return ((OnErrorSentinel ) n ).e ;
0 commit comments