autodispose-lifecycle / com.uber.autodispose.lifecycle / LifecycleScopeProvider

LifecycleScopeProvider

@DoNotMock("Use TestLifecycleScopeProvider instead") interface LifecycleScopeProvider<E : Any> : ScopeProvider

A convenience interface that, when implemented, helps provide information to create implementations that resolve the next corresponding lifecycle event and construct a Completable representation of it from the #lifecycle() stream.

Convenience resolver utilities for this can be found in LifecycleScopes.

Parameters

- the lifecycle event type.

See Also
LifecycleScopes

Functions

correspondingEvents

abstract fun correspondingEvents(): CorrespondingEventsFunction<E>

lifecycle

abstract fun lifecycle(): Observable<E>

peekLifecycle

abstract fun peekLifecycle(): E?

requestScope

open fun requestScope(): CompletableSource

Inheritors

TestLifecycleScopeProvider

class TestLifecycleScopeProvider : LifecycleScopeProvider<TestLifecycle>

Test utility to create LifecycleScopeProvider instances for tests.

Supports a start and stop lifecycle. Subscribing when outside of the lifecycle will throw either a LifecycleNotStartedException or LifecycleEndedException.