Class RealmFlowFactory
- java.lang.Object
-
- io.realm.coroutines.RealmFlowFactory
-
- All Implemented Interfaces:
FlowFactory
public class RealmFlowFactory extends Object implements FlowFactory
Factory class used to create coroutineFlow
s.This class is used by default unless overridden in
RealmConfiguration.Builder.flowFactory(FlowFactory)
.
-
-
Constructor Summary
Constructors Constructor Description RealmFlowFactory(Boolean returnFrozenObjects)
Constructor for the Flow factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description kotlinx.coroutines.flow.Flow<ObjectChange<DynamicRealmObject>>
changesetFrom(DynamicRealm dynamicRealm, DynamicRealmObject dynamicRealmObject)
Creates aFlow
for aDynamicRealmObject
.<T> kotlinx.coroutines.flow.Flow<CollectionChange<RealmList<T>>>
changesetFrom(DynamicRealm dynamicRealm, RealmList<T> list)
Creates aFlow
for aRealmList
.<T> kotlinx.coroutines.flow.Flow<CollectionChange<RealmResults<T>>>
changesetFrom(DynamicRealm dynamicRealm, RealmResults<T> results)
Creates aFlow
for aRealmResults
instance.<T> kotlinx.coroutines.flow.Flow<CollectionChange<RealmList<T>>>
changesetFrom(Realm realm, RealmList<T> list)
Creates aFlow
for aRealmList
.<T> kotlinx.coroutines.flow.Flow<CollectionChange<RealmResults<T>>>
changesetFrom(Realm realm, RealmResults<T> results)
Creates aFlow
for aRealmResults
instance.<T extends RealmModel>
kotlinx.coroutines.flow.Flow<ObjectChange<T>>changesetFrom(Realm realm, T realmObject)
Creates aFlow
for aRealmObject
.kotlinx.coroutines.flow.Flow<DynamicRealm>
from(DynamicRealm dynamicRealm)
Creates aFlow
for aDynamicRealm
.kotlinx.coroutines.flow.Flow<DynamicRealmObject>
from(DynamicRealm dynamicRealm, DynamicRealmObject dynamicRealmObject)
Creates aFlow
for aDynamicRealmObject
.<T> kotlinx.coroutines.flow.Flow<RealmList<T>>
from(DynamicRealm dynamicRealm, RealmList<T> realmList)
Creates aFlow
for aRealmList
.<T> kotlinx.coroutines.flow.Flow<RealmResults<T>>
from(DynamicRealm dynamicRealm, RealmResults<T> results)
Creates aFlow
for aRealmResults
.kotlinx.coroutines.flow.Flow<Realm>
from(Realm realm)
Creates aFlow
for aRealm
.<T> kotlinx.coroutines.flow.Flow<RealmList<T>>
from(Realm realm, RealmList<T> realmList)
Creates aFlow
for aRealmList
.<T> kotlinx.coroutines.flow.Flow<RealmResults<T>>
from(Realm realm, RealmResults<T> results)
Creates aFlow
for aRealmResults
.<T extends RealmModel>
kotlinx.coroutines.flow.Flow<T>from(Realm realm, T realmObject)
Creates aFlow
for aRealmObject
.
-
-
-
Constructor Detail
-
RealmFlowFactory
public RealmFlowFactory(Boolean returnFrozenObjects)
Constructor for the Flow factory.- Parameters:
returnFrozenObjects
- whether the emissions should return frozen objects or not.
-
-
Method Detail
-
from
public kotlinx.coroutines.flow.Flow<Realm> from(@Nonnull Realm realm)
Description copied from interface:FlowFactory
Creates aFlow
for aRealm
. It should emit the initial state of the Realm when subscribed to and on each subsequent update of the Realm.- Specified by:
from
in interfaceFlowFactory
- Parameters:
realm
-Realm
instance being observed for changes to be emitted by the flow.- Returns:
- Flow that emits all updates to the Realm.
-
from
public kotlinx.coroutines.flow.Flow<DynamicRealm> from(@Nonnull DynamicRealm dynamicRealm)
Description copied from interface:FlowFactory
Creates aFlow
for aDynamicRealm
. It should emit the initial state of the Realm when subscribed to and on each subsequent update of the Realm.- Specified by:
from
in interfaceFlowFactory
- Parameters:
dynamicRealm
-DynamicRealm
instance being observed for changes to be emitted by the flow.- Returns:
- Flow that emits all updates to the Realm.
-
from
public <T> kotlinx.coroutines.flow.Flow<RealmResults<T>> from(@Nonnull Realm realm, @Nonnull RealmResults<T> results)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmResults
. It should emit the initial RealmResult when subscribed to and on each subsequent update of the RealmResults.- Specified by:
from
in interfaceFlowFactory
- Type Parameters:
T
- type of RealmObject.- Parameters:
realm
-Realm
instance from where the results are coming.results
-RealmResults
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the RealmObject.
-
changesetFrom
public <T> kotlinx.coroutines.flow.Flow<CollectionChange<RealmResults<T>>> changesetFrom(@Nonnull Realm realm, @Nonnull RealmResults<T> results)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmResults
instance. It should emit the initial results when subscribed to and on each subsequent update of the results it should emit the results plus theCollectionChange
that describes the update.Changeset observables do not support backpressure as a changeset depends on the state of the previous changeset. Handling backpressure should therefore be left to the user.
- Specified by:
changesetFrom
in interfaceFlowFactory
- Parameters:
realm
-Realm
instance from where the object is coming.results
-RealmResults
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the RealmResults.
-
from
public <T> kotlinx.coroutines.flow.Flow<RealmResults<T>> from(@Nonnull DynamicRealm dynamicRealm, @Nonnull RealmResults<T> results)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmResults
. It should emit the initial RealmResult when subscribed to and on each subsequent update of the RealmResults.- Specified by:
from
in interfaceFlowFactory
- Type Parameters:
T
- type of RealmObject.- Parameters:
dynamicRealm
-DynamicRealm
instance from where the results are coming.results
-RealmResults
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the RealmObject.
-
changesetFrom
public <T> kotlinx.coroutines.flow.Flow<CollectionChange<RealmResults<T>>> changesetFrom(@Nonnull DynamicRealm dynamicRealm, @Nonnull RealmResults<T> results)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmResults
instance. It should emit the initial results when subscribed to and on each subsequent update of the results it should emit the results plus theCollectionChange
that describes the update.Changeset observables do not support backpressure as a changeset depends on the state of the previous changeset. Handling backpressure should therefore be left to the user.
- Specified by:
changesetFrom
in interfaceFlowFactory
- Parameters:
dynamicRealm
-DynamicRealm
instance from where the object is coming.results
-RealmResults
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the RealmResults.
-
from
public <T> kotlinx.coroutines.flow.Flow<RealmList<T>> from(@Nonnull Realm realm, @Nonnull RealmList<T> realmList)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmList
. It should emit the initial RealmResult when subscribed to and on each subsequent update of the RealmList.Note:
RealmChangeListener
is currently not supported on RealmLists.- Specified by:
from
in interfaceFlowFactory
- Type Parameters:
T
- type of RealmObject- Parameters:
realm
-Realm
instance from where the results are coming.realmList
-RealmList
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emit all updates to the RealmList.
-
changesetFrom
public <T> kotlinx.coroutines.flow.Flow<CollectionChange<RealmList<T>>> changesetFrom(@Nonnull Realm realm, @Nonnull RealmList<T> list)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmList
. It should emit the initial list when subscribed to and on each subsequent update of the list it should emit the list plus theCollectionChange
that describes the update.Changeset observables do not support backpressure as a changeset depends on the state of the previous changeset. Handling backpressure should therefore be left to the user.
- Specified by:
changesetFrom
in interfaceFlowFactory
- Parameters:
realm
-Realm
instance from where the object is coming.list
-RealmList
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the RealmList.
-
from
public <T> kotlinx.coroutines.flow.Flow<RealmList<T>> from(@Nonnull DynamicRealm dynamicRealm, @Nonnull RealmList<T> realmList)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmList
. It should emit the initial RealmResult when subscribed to and on each subsequent update of the RealmList.Note:
RealmChangeListener
is currently not supported on RealmLists.- Specified by:
from
in interfaceFlowFactory
- Type Parameters:
T
- type of RealmObject- Parameters:
dynamicRealm
-DynamicRealm
instance from where the results are coming.realmList
-RealmList
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emit all updates to the RealmList.
-
changesetFrom
public <T> kotlinx.coroutines.flow.Flow<CollectionChange<RealmList<T>>> changesetFrom(@Nonnull DynamicRealm dynamicRealm, @Nonnull RealmList<T> list)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmList
. It should emit the initial list when subscribed to and on each subsequent update of the list it should emit the list plus theCollectionChange
that describes the update.Changeset observables do not support backpressure as a changeset depends on the state of the previous changeset. Handling backpressure should therefore be left to the user.
- Specified by:
changesetFrom
in interfaceFlowFactory
- Parameters:
dynamicRealm
-DynamicRealm
instance from where the object is coming.list
-RealmList
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the RealmList.
-
from
public <T extends RealmModel> kotlinx.coroutines.flow.Flow<T> from(@Nonnull Realm realm, @Nonnull T realmObject)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmObject
. It should emit the initial object when subscribed to and on each subsequent update of the object.- Specified by:
from
in interfaceFlowFactory
- Type Parameters:
T
- type of query target- Parameters:
realm
-Realm
instance from where the object is coming.realmObject
-RealmObject
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the DynamicRealmObject.
-
changesetFrom
public <T extends RealmModel> kotlinx.coroutines.flow.Flow<ObjectChange<T>> changesetFrom(@Nonnull Realm realm, @Nonnull T realmObject)
Description copied from interface:FlowFactory
Creates aFlow
for aRealmObject
. It should emit the initial object when subscribed to and on each subsequent update of the object it should emit the object plus theObjectChangeSet
that describes the update.Changeset observables do not support backpressure as a changeset depends on the state of the previous changeset. Handling backpressure should therefore be left to the user.
- Specified by:
changesetFrom
in interfaceFlowFactory
- Parameters:
realm
-Realm
instance from where the object is coming.realmObject
-RealmObject
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the DynamicRealmObject.
-
from
public kotlinx.coroutines.flow.Flow<DynamicRealmObject> from(@Nonnull DynamicRealm dynamicRealm, @Nonnull DynamicRealmObject dynamicRealmObject)
Description copied from interface:FlowFactory
Creates aFlow
for aDynamicRealmObject
. It should emit the initial object when subscribed to and on each subsequent update of the object.- Specified by:
from
in interfaceFlowFactory
- Parameters:
dynamicRealm
-DynamicRealm
instance from where the object is coming.dynamicRealmObject
-DynamicRealmObject
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the DynamicRealmObject.
-
changesetFrom
public kotlinx.coroutines.flow.Flow<ObjectChange<DynamicRealmObject>> changesetFrom(@Nonnull DynamicRealm dynamicRealm, @Nonnull DynamicRealmObject dynamicRealmObject)
Description copied from interface:FlowFactory
Creates aFlow
for aDynamicRealmObject
. It should emit the initial object when subscribed to and on each subsequent update of the object it should emit the object plus theObjectChangeSet
that describes the update.Changeset observables do not support backpressure as a changeset depends on the state of the previous changeset. Handling backpressure should therefore be left to the user.
- Specified by:
changesetFrom
in interfaceFlowFactory
- Parameters:
dynamicRealm
-DynamicRealm
instance from where the object is coming.dynamicRealmObject
-DynamicRealmObject
instance being observed for changes to be emitted by the flow.- Returns:
Flow
that emits all updates to the DynamicRealmObject.
-
-