Observer once the source Observable
has completed. The item is cached and published to any Observers which subscribe after the source
has completed. If the source emitted no items, AsyncSubject completes without emitting anything.
If the source terminated in an error, current and future subscribers will receive only the error.
Example usage:
// observer will receive no onNext events because the subject.onCompleted() isn't called.
AsyncSubject<Object> subject = AsyncSubject.create();
subject.subscribe(observer);
subject.onNext("one");
subject.onNext("two");
subject.onNext("three");
// observer will receive "three" as the only onNext event.
AsyncSubject<Object> subject = AsyncSubject.create();
subject.subscribe(observer);
subject.onNext("one");
subject.onNext("two");
subject.onNext("three");
subject.onCompleted();
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile Object | |
| pack-priv final SubjectSubscriptionManager |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static < the result value type T> AsyncSubject | |
| public Throwable | Returns: the Throwable that terminated the Subject ornull if the
subject hasn't terminated yet or it terminated normally.Returns the Throwable that terminated the Subject. |
| public T | Returns: the current value ornull if the Subject doesn't have a value,
has terminated with an exception or has an actual null as a value.Returns the current value of the Subject if there is such a value and the subject hasn't terminated with an exception. |
| public boolean | Returns: true if the subject completed normally viaonCompleted()Check if the Subject has terminated normally. |
| public boolean | hasObservers()
Implements abstract rx. Subject has Observers subscribed to it.
|
| public boolean | Returns: true if the subject has received a throwable throughonError.Check if the Subject has terminated with an exception. |
| public boolean | Returns: true if and only if the subject has some value but not an errorCheck if the Subject has a value. |
| public void | onCompleted()
Implements rx. Observable has finished sending push-based notifications.
|
| public void | onError(final Throwable
the exception encountered by the Observable e)Implements rx. Observable has experienced an error condition.
|
| public void | onNext(T
the item emitted by the Observable v)Implements rx. |
| lastValue | back to summary |
|---|---|
| pack-priv volatile Object lastValue | |
| state | back to summary |
|---|---|
| pack-priv final SubjectSubscriptionManager<T> state | |
| AsyncSubject | back to summary |
|---|---|
| protected AsyncSubject(Observable. | |
| create | back to summary |
|---|---|
| public static <T> AsyncSubject Creates and returns a new
| |
| getThrowable | back to summary |
|---|---|
| public Throwable getThrowable() Returns the Throwable that terminated the Subject.
| |
| getValue | back to summary |
|---|---|
| public T getValue() Returns the current value of the Subject if there is such a value and the subject hasn't terminated with an exception. The method can return
| |
| hasCompleted | back to summary |
|---|---|
| public boolean hasCompleted() Check if the Subject has terminated normally.
| |
| hasObservers | back to summary |
|---|---|
| public boolean hasObservers() Implements abstract rx. Doc from rx. Indicates whether the
| |
| hasThrowable | back to summary |
|---|---|
| public boolean hasThrowable() Check if the Subject has terminated with an exception.
| |
| hasValue | back to summary |
|---|---|
| public boolean hasValue() Check if the Subject has a value. Use the Note that unless
| |
| onCompleted | back to summary |
|---|---|
| public void onCompleted() Implements rx. Doc from rx. Notifies the Observer that the
The
| |
| onError | back to summary |
|---|---|
| public void onError(final Throwable e) Implements rx. Doc from rx. Notifies the Observer that the
If the | |
| onNext | back to summary |
|---|---|
| public void onNext(T v) Implements rx. Doc from rx. Provides the Observer with a new item to observe.
The
The
| |