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 supportTestSubscriber
andTestObserver
.DefaultObserver<T> Abstract base implementation of anObserver
with support for cancelling a subscription viaDefaultObserver.cancel()
(synchronously) and callsDefaultObserver.onStart()
when the subscription happens.DisposableCompletableObserver An abstractCompletableObserver
that allows asynchronous cancellation by implementing Disposable.DisposableMaybeObserver<T> An abstractMaybeObserver
that allows asynchronous cancellation by implementingDisposable
.DisposableObserver<T> An abstractObserver
that allows asynchronous cancellation by implementingDisposable
.DisposableSingleObserver<T> An abstractSingleObserver
that allows asynchronous cancellation by implementingDisposable
.ResourceCompletableObserver An abstractCompletableObserver
that allows asynchronous cancellation of its subscription and associated resources.ResourceMaybeObserver<T> An abstractMaybeObserver
that allows asynchronous cancellation of its subscription and associated resources.ResourceObserver<T> An abstractObserver
that allows asynchronous cancellation of its subscription and associated resources.ResourceSingleObserver<T> An abstractSingleObserver
that allows asynchronous cancellation of its subscription and the associated resources.SafeObserver<T> Wraps anotherObserver
and ensures allonXXX
methods 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
,SingleObserver
andCompletableObserver
composite that can record events fromObservable
s,Maybe
s,Single
s andCompletable
s and allows making assertions about them. -
Enum Summary Enum Description TestObserver.EmptyObserver An observer that ignores all events and does not report errors.