autodispose-lifecycle / com.uber.autodispose.lifecycle

Package com.uber.autodispose.lifecycle

Types

CorrespondingEventsFunction

interface CorrespondingEventsFunction<E : Any> : Function<E, E>

A corresponding events function that acts as a normal Function but ensures a single event type in the generic and tightens the possible exception thrown to OutsideScopeException.

LifecycleScopeProvider

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.

LifecycleScopes

class LifecycleScopes

Utilities for dealing with LifecycleScopeProviders. This includes factories for resolving Completable representations of scopes, corresponding events, etc.

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.

Exceptions

LifecycleEndedException

open class LifecycleEndedException : OutsideScopeException

Signifies an error occurred due to execution starting after the lifecycle has ended.

LifecycleNotStartedException

open class LifecycleNotStartedException : OutsideScopeException

Signifies an error occurred due to execution starting before the lifecycle has started.