InvalidationTracker.Observer


public abstract class InvalidationTracker.Observer


An observer that can listen for changes in the database by subscribing to an InvalidationTracker.

Summary

Public constructors

Observer(@NonNull String[] tables)

Protected constructors

Observer(@NonNull String firstTable, @NonNull String rest)

Creates an observer for the given tables and views.

Public methods

abstract void

Invoked when one of the observed tables is invalidated (changed).

Public constructors

Observer

Added in 2.0.0
public Observer(@NonNull String[] tables)
Parameters
@NonNull String[] tables

The names of the tables this observer is interested in getting notified if they are modified.

Protected constructors

Observer

Added in 2.0.0
protected Observer(@NonNull String firstTable, @NonNull String rest)

Creates an observer for the given tables and views.

Parameters
@NonNull String firstTable

The name of the table or view.

@NonNull String rest

More names of tables or views.

Public methods

onInvalidated

Added in 2.0.0
public abstract void onInvalidated(@NonNull Set<@NonNull String> tables)

Invoked when one of the observed tables is invalidated (changed).

Parameters
@NonNull Set<@NonNull String> tables

A set of invalidated tables. When the observer is interested in multiple tables, this set can be used to distinguish which of the observed tables were invalidated. When observing a database view the names of underlying tables will be in the set instead of the view name.