|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrx.Observable<R>
rx.subjects.Subject<T,T>
rx.subjects.BehaviorSubject<T>
T - public class BehaviorSubject<T>
Subject that publishes the most recent and all subsequent events to each subscribed Observer.
Example usage:
/ observer will receive all events.
BehaviorSubject<Object> subject = BehaviorSubject.createWithDefaultValue("default");
subject.subscribe(observer);
subject.onNext("one");
subject.onNext("two");
subject.onNext("three");
// observer will receive the "one", "two" and "three" events, but not "zero"
BehaviorSubject<Object> subject = BehaviorSubject.createWithDefaultValue("default");
subject.onNext("zero");
subject.onNext("one");
subject.subscribe(observer);
subject.onNext("two");
subject.onNext("three");
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class rx.Observable |
|---|
Observable.OnSubscribeFunc<T> |
| Constructor Summary | |
|---|---|
protected |
BehaviorSubject(java.util.concurrent.atomic.AtomicReference<T> currentValue,
Observable.OnSubscribeFunc<T> onSubscribe,
java.util.concurrent.ConcurrentHashMap<Subscription,Observer<? super T>> observers)
|
| Method Summary | ||
|---|---|---|
static
|
createWithDefaultValue(T defaultValue)
Creates a BehaviorSubject which publishes the last and all subsequent events to each Observer that subscribes to it. |
|
void |
onCompleted()
Notifies the Observer that the Observable has finished sending push-based notifications. |
|
void |
onError(java.lang.Throwable e)
Notifies the Observer that the Observable has experienced an error condition. |
|
void |
onNext(T args)
Provides the Observer with new data. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected BehaviorSubject(java.util.concurrent.atomic.AtomicReference<T> currentValue,
Observable.OnSubscribeFunc<T> onSubscribe,
java.util.concurrent.ConcurrentHashMap<Subscription,Observer<? super T>> observers)
| Method Detail |
|---|
public static <T> BehaviorSubject<T> createWithDefaultValue(T defaultValue)
BehaviorSubject which publishes the last and all subsequent events to each Observer that subscribes to it.
defaultValue - The value which will be published to any Observer as long as the BehaviorSubject has not yet received any events.
BehaviorSubject.public void onCompleted()
ObserverObservable has finished sending push-based notifications.
The Observable will not call this closure if it calls onError.
public void onError(java.lang.Throwable e)
ObserverObservable has experienced an error condition.
If the Observable calls this closure, it will not thereafter call onNext or onCompleted.
public void onNext(T args)
Observer
The Observable calls this closure 1 or more times, unless it calls onError in which case this closure may never be called.
The Observable will not call this closure again after it calls either onCompleted or onError.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||