InvalidatingPagingSourceFactory


public final class InvalidatingPagingSourceFactory<Key extends Object, Value extends Object> implements PagingSourceFactory


Wrapper class for a PagingSource factory intended for usage in Pager construction.

Calling invalidate on this InvalidatingPagingSourceFactory will forward invalidate signals to all active PagingSources that were produced by calling invoke.

This class is thread-safe for concurrent calls to any mutative operations including both invoke and invalidate.

Summary

Public constructors

<Key extends Object, Value extends Object> InvalidatingPagingSourceFactory(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> pagingSourceFactory
)

Public methods

final void

Calls PagingSource.invalidate on each PagingSource that was produced by this InvalidatingPagingSourceFactory

@NonNull PagingSource<@NonNull Key, @NonNull Value>

Public constructors

InvalidatingPagingSourceFactory

public <Key extends Object, Value extends Object> InvalidatingPagingSourceFactory(
    @NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> pagingSourceFactory
)
Parameters
@NonNull Function0<@NonNull PagingSource<@NonNull Key, @NonNull Value>> pagingSourceFactory

The PagingSource factory that returns a PagingSource when called

Public methods

invalidate

Added in 3.0.0
public final void invalidate()

Calls PagingSource.invalidate on each PagingSource that was produced by this InvalidatingPagingSourceFactory

invoke

Added in 3.0.0
public @NonNull PagingSource<@NonNull Key, @NonNull Value> invoke()
Returns
@NonNull PagingSource<@NonNull Key, @NonNull Value>

PagingSource which will be invalidated when this factory's invalidate method is called