-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.x: fix/clarify the Observable class' javadoc #5432
Merged
akarnokd
merged 2 commits into
ReactiveX:2.x
from
akarnokd:ObservableJavadocClarifications
Jun 23, 2017
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,12 +34,12 @@ | |
import io.reactivex.schedulers.*; | ||
|
||
/** | ||
* The Observable class that is designed similar to the Reactive-Streams Pattern, minus the backpressure, | ||
* and offers factory methods, intermediate operators and the ability to consume reactive dataflows. | ||
* The Observable class is the non-backpressured, optionally multi-valued base reactive class that | ||
* offers factory methods, intermediate operators and the ability to consume synchronous | ||
* and/or asynchronous reactive dataflows. | ||
* <p> | ||
* Reactive-Streams operates with {@code ObservableSource}s which {@code Observable} extends. Many operators | ||
* therefore accept general {@code ObservableSource}s directly and allow direct interoperation with other | ||
* Reactive-Streams implementations. | ||
* Many operators in the class accept {@code ObservableSource}(s), the base reactive interface | ||
* for such non-backpressured flows, which {@code Observable} itself implements as well. | ||
* <p> | ||
* The Observable's operators, by default, run with a buffer size of 128 elements (see {@link Flowable#bufferSize()}, | ||
* that can be overridden globally via the system parameter {@code rx2.buffer-size}. Most operators, however, have | ||
|
@@ -49,11 +49,50 @@ | |
* <p> | ||
* <img width="640" height="317" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/legend.png" alt=""> | ||
* <p> | ||
* For more information see the <a href="http://reactivex.io/documentation/ObservableSource.html">ReactiveX | ||
* documentation</a>. | ||
* | ||
* The design of this class was derived from the | ||
* <a href="https://github.com/reactive-streams/reactive-streams-jvm">Reactive-Streams design and specification</a> | ||
* by removing any backpressure-related infrastructure and implementation detail, replacing the | ||
* {@code org.reactivestreams.Subscription} with {@link Disposable} as the primary means to cancel | ||
* a flow. | ||
* <p> | ||
* The {@code Observable} follows the protocol | ||
* <pre><code> | ||
* onSubscribe onNext* (onError | onComplete)? | ||
* </code></pre> | ||
* where | ||
* the stream can be disposed through the {@code Disposable} instance provided to consumers through | ||
* {@code Observer.onSubscribe}. | ||
* <p> | ||
* Unlike the {@code Observable} of version 1.x, {@link #subscribe(Observer)} does not allow external cancellation | ||
* of a subscription and the {@code Observer} instance is expected to expose such capability. | ||
* <p>Example: | ||
* <pre><code> | ||
* Disposable d = Observable.just("Hello world!") | ||
* .delay(1, TimeUnit.SECONDS) | ||
* .subscribeWith(new DisposableObserver<String>() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The closing |
||
* @Override public void onStart() { | ||
* System.out.println("Start!"); | ||
* } | ||
* @Override public void onNext(Integer t) { | ||
* System.out.println(t); | ||
* } | ||
* @Override public void onError(Throwable t) { | ||
* t.printStackTrace(); | ||
* } | ||
* @Override public void onComplete() { | ||
* System.out.println("Done!"); | ||
* } | ||
* }); | ||
* | ||
* Thread.sleep(500); | ||
* // the sequence now can be cancelled via dispose() | ||
* d.dispose(); | ||
* </code></pre> | ||
* | ||
* @param <T> | ||
* the type of the items emitted by the Observable | ||
* @see Flowable | ||
* @see io.reactivex.observers.DisposableObserver | ||
*/ | ||
public abstract class Observable<T> implements ObservableSource<T> { | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
onNext(T)*
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameters are omitted to avoid conflict with the regexp-like pattern