Package io.reactivex.rxjava3.observers
Default wrappers and implementations for observer-based consumer classes and interfaces,
including disposable and resource-tracking variants and
the
TestObserver that allows unit testing
Observable-, Single-,
Maybe- and Completable-based flows.
Available observer variants
| Reactive type | Base interface | Simple | Disposable | Resource |
Observable |
Observer |
DefaultObserver |
DisposableObserver |
DisposableObserver |
Maybe |
MaybeObserver |
N/A | DisposableMaybeObserver |
DisposableMaybeObserver |
Single |
SingleObserver |
N/A | DisposableSingleObserver |
DisposableSingleObserver |
Completable |
CompletableObserver |
N/A | DisposableCompletableObserver |
DisposableCompletableObserver |
-
Interface Summary Interface Description LambdaConsumerIntrospection An interface that indicates that the implementing type is composed of individual components and exposes information about their behavior. -
Class Summary Class Description BaseTestConsumer<T,U extends BaseTestConsumer<T,U>> Base class with shared infrastructure to supportTestSubscriberandTestObserver.DefaultObserver<T> Abstract base implementation of anObserverwith support for cancelling a subscription viaDefaultObserver.cancel()(synchronously) and callsDefaultObserver.onStart()when the subscription happens.DisposableCompletableObserver An abstractCompletableObserverthat allows asynchronous cancellation by implementing Disposable.DisposableMaybeObserver<T> An abstractMaybeObserverthat allows asynchronous cancellation by implementingDisposable.DisposableObserver<T> An abstractObserverthat allows asynchronous cancellation by implementingDisposable.DisposableSingleObserver<T> An abstractSingleObserverthat allows asynchronous cancellation by implementingDisposable.ResourceCompletableObserver An abstractCompletableObserverthat allows asynchronous cancellation of its subscription and associated resources.ResourceMaybeObserver<T> An abstractMaybeObserverthat allows asynchronous cancellation of its subscription and associated resources.ResourceObserver<T> An abstractObserverthat allows asynchronous cancellation of its subscription and associated resources.ResourceSingleObserver<T> An abstractSingleObserverthat allows asynchronous cancellation of its subscription and the associated resources.SafeObserver<T> Wraps anotherObserverand ensures allonXXXmethods conform the protocol (except the requirement for serialized access).SerializedObserver<T> Serializes access to theObserver.onNext(Object),Observer.onError(Throwable)andObserver.onComplete()methods of anotherObserver.TestObserver<T> AnObserver,MaybeObserver,SingleObserverandCompletableObservercomposite that can record events fromObservables,Maybes,Singles andCompletables and allows making assertions about them. -
Enum Summary Enum Description TestObserver.EmptyObserver An observer that ignores all events and does not report errors.