Factory

class Factory<T : RealmModel, R : Any>(realmQueryBuilder: RealmQueryBuilder<T>, transform: RealmModelTransform<T, R>) : DataSource.Factory<Int, R>

DataSource.Factory implementation to construct RealmTiledDataSource

Parameters

realmQueryBuilder

The builder function that will be used to construct RealmQuery instance. Will be called on loading thread.

transform

The transformation function that will be used to map live managed RealmModel instances to type R. The R should be unmanaged RealmModel objects or custom types. If managed instances are returned, then thread safety is not guaranteed.

Constructors

Factory
Link copied to clipboard
fun Factory(realmQueryBuilder: RealmQueryBuilder<T>, transform: RealmModelTransform<T, R>)
The builder function that will be used to construct RealmQuery instance.

Functions

asPagingSourceFactory
Link copied to clipboard
fun asPagingSourceFactory(fetchDispatcher: CoroutineDispatcher): () -> PagingSource<Int, R>
create
Link copied to clipboard
open override fun create(): RealmTiledDataSource<T, R>
map
Link copied to clipboard
open fun <ToValue : Any> map(function: Function<R, ToValue>): DataSource.Factory<Int, ToValue>
open fun <ToValue : Any> map(function: (R) -> ToValue): DataSource.Factory<Int, ToValue>
mapByPage
Link copied to clipboard
open fun <ToValue : Any> mapByPage(function: Function<List<R>, List<ToValue>>): DataSource.Factory<Int, ToValue>
open fun <ToValue : Any> mapByPage(function: (List<R>) -> List<ToValue>): DataSource.Factory<Int, ToValue>