Factory
abstract class Factory<Key : Any, Value : Any>
kotlin.Any | |
↳ | androidx.paging.DataSource.Factory |
Factory for DataSources.
Data-loading systems of an application or library can implement this interface to allow
LiveData<PagedList>
s to be created. For example, Room can provide a
DataSource.Factory for a given SQL query:
@Dao interface UserDao { @Query("SELECT * FROM user ORDER BY lastName ASC") public abstract DataSource.Factory<Integer, User> usersByLastName(); }
In the above sample, Integer
is used because it is the Key
type of
PositionalDataSource. Currently, Room uses the LIMIT
/OFFSET
SQL keywords to
page a large query with a PositionalDataSource.
Summary
Public constructors | |
---|---|
<init>() Factory for DataSources. |
Public methods | |
---|---|
() -> PagingSource<Key, Value> |
asPagingSourceFactory(fetchDispatcher: CoroutineDispatcher = Dispatchers.IO) |
abstract DataSource<Key, Value> |
create() Create a DataSource. |
open DataSource.Factory<Key, ToValue> |
Applies the given function to each value emitted by DataSources produced by this Factory. |
open DataSource.Factory<Key, ToValue> |
map(function: (Value) -> ToValue) Applies the given function to each value emitted by DataSources produced by this Factory. |
open DataSource.Factory<Key, ToValue> |
Applies the given function to each value emitted by DataSources produced by this Factory. |
open DataSource.Factory<Key, ToValue> |
Applies the given function to each value emitted by DataSources produced by this Factory. |
Extension functions | ||||||||
---|---|---|---|---|---|---|---|---|
From androidx.paging
|