RxRoom

Added in 2.3.0

public final class RxRoom


Summary

Public fields

static final @NonNull Object

Data dispatched by the publisher created by createFlowable.

Public methods

static final @NonNull Flowable<@NonNull Object>
createFlowable(
    @NonNull RoomDatabase database,
    @NonNull String tableNames
)

Creates a Flowable that emits at least once and also re-emits whenever one of the observed tables is updated.

static final @NonNull Observable<@NonNull Object>
createObservable(
    @NonNull RoomDatabase database,
    @NonNull String tableNames
)

Creates a Observable that emits at least once and also re-emits whenever one of the observed tables is updated.

Public fields

NOTHING

public static final @NonNull Object NOTHING

Data dispatched by the publisher created by createFlowable.

Public methods

createFlowable

public static final @NonNull Flowable<@NonNull ObjectcreateFlowable(
    @NonNull RoomDatabase database,
    @NonNull String tableNames
)

Creates a Flowable that emits at least once and also re-emits whenever one of the observed tables is updated.

You can easily chain a database operation to downstream of this Flowable to ensure that it re-runs when database is modified.

Since database invalidation is batched, multiple changes in the database may results in just 1 emission.

Parameters
@NonNull RoomDatabase database

The database instance

@NonNull String tableNames

The list of table names that should be observed

Returns
@NonNull Flowable<@NonNull Object>

A Flowable which emits NOTHING when one of the observed tables is modified (also once when the invalidation tracker connection is established).

createObservable

public static final @NonNull Observable<@NonNull ObjectcreateObservable(
    @NonNull RoomDatabase database,
    @NonNull String tableNames
)

Creates a Observable that emits at least once and also re-emits whenever one of the observed tables is updated.

You can easily chain a database operation to downstream of this Observable to ensure that it re-runs when database is modified.

Since database invalidation is batched, multiple changes in the database may results in just 1 emission.

Parameters
@NonNull RoomDatabase database

The database instance

@NonNull String tableNames

The list of table names that should be observed

Returns
@NonNull Observable<@NonNull Object>

A Observable which emits NOTHING when one of the observed tables is modified (also once when the invalidation tracker connection is established).