Skip to content

Commit 022ae66

Browse files
committed
Filling in javadoc gaps where I feel confident enough to do so...
1 parent 8213986 commit 022ae66

17 files changed

+232
-117
lines changed

rxjava-core/src/main/java/rx/internal/operators/BlockingOperatorLatest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ private BlockingOperatorLatest() {
3636
}
3737

3838
/**
39-
* @warn latest() missing javadoc
39+
* Returns an {@code Iterable} that blocks until or unless the {@code Observable} emits an item that has not
40+
* been returned by the {@code Iterable}, then returns that item
41+
*
4042
* @param source
41-
* @return
43+
* the source {@code Observable}
44+
* @return an {@code Iterable} that blocks until or unless the {@code Observable} emits an item that has not
45+
* been returned by the {@code Iterable}, then returns that item
4246
*/
4347
public static <T> Iterable<T> latest(final Observable<? extends T> source) {
4448
return new Iterable<T>() {

rxjava-core/src/main/java/rx/internal/operators/BlockingOperatorMostRecent.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@
3030
public final class BlockingOperatorMostRecent {
3131

3232
/**
33-
* @warn mostRecent() missing javadocs
33+
* Returns an {@code Iterable} that always returns the item most recently emitted by the {@code Observable}.
34+
*
3435
* @param source
36+
* the source {@code Observable}
3537
* @param initialValue
36-
* @return
38+
* a default item to return from the {@code Iterable} if {@code source} has not yet emitted any
39+
* items
40+
* @return an {@code Iterable} that always returns the item most recently emitted by {@code source}, or
41+
* {@code initialValue} if {@code source} has not yet emitted any items
3742
*/
3843
public static <T> Iterable<T> mostRecent(final Observable<? extends T> source, final T initialValue) {
3944

rxjava-core/src/main/java/rx/internal/operators/BlockingOperatorNext.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@
3434
public final class BlockingOperatorNext {
3535

3636
/**
37-
* @warn next() missing javadocs
37+
* Returns an {@code Iterable} that blocks until the {@code Observable} emits another item, then returns
38+
* that item.
39+
*
3840
* @param items
39-
* @return
41+
* the {@code Observable} to observe
42+
* @return an {@code Iterable} that behaves like a blocking version of {@code items}
4043
*/
4144
public static <T> Iterable<T> next(final Observable<? extends T> items) {
4245
return new Iterable<T>() {

rxjava-core/src/main/java/rx/internal/operators/BufferUntilSubscriber.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@
4646
* {@code pivot} and trades off the possibility of memory leak for deterministic functionality.
4747
*
4848
* @see <a href="https://github.com/Netflix/RxJava/issues/844">the Github issue describing the time gap problem</a>
49-
* @warn type param "T" undescribed
5049
* @param <T>
50+
* the type of the items to be buffered
5151
*/
5252
public class BufferUntilSubscriber<T> extends Subject<T, T> {
5353

5454
/**
5555
* @warn create() undescribed
56+
* @return
5657
*/
5758
public static <T> BufferUntilSubscriber<T> create() {
5859
State<T> state = new State<T>();

rxjava-core/src/main/java/rx/internal/operators/NotificationLite.java

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
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
*/
3637
public 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

Comments
 (0)