kotlin-extensions / io.realm.kotlin / io.realm.RealmModel

Extensions for io.realm.RealmModel

deleteFromRealm

Deletes the object from the Realm it is currently associated with.

fun RealmModel.deleteFromRealm(): Unit

freeze

Returns a frozen snapshot of this object. The frozen copy can be read and queried from any thread without throwing an IllegalStateException.

fun <T : RealmModel> RealmModel.freeze(): T

isFrozen

Returns whether or not this RealmModel is frozen.

fun RealmModel.isFrozen(): Boolean

isLoaded

Checks if the query used to find this RealmObject has completed.

fun RealmModel.isLoaded(): Boolean

isManaged

Checks if this object is managed by Realm. A managed object is just a wrapper around the data in the underlying Realm file. On Looper threads, a managed object will be live-updated so it always points to the latest data. It is possible to register a change listener using addChangeListener to be notified when changes happen. Managed objects are thread confined so that they cannot be accessed from other threads than the one that created them.

fun RealmModel.isManaged(): Boolean

isValid

Checks if the RealmObject is still valid to use i.e., the RealmObject hasn't been deleted nor has the Realm been closed. It will always return true for unmanaged objects.

fun RealmModel.isValid(): Boolean

load

Makes an asynchronous query blocking. This will also trigger any registered listeners.

fun RealmModel.load(): Boolean

removeAllChangeListeners

Removes all registered listeners from the given RealmObject.

fun RealmModel.removeAllChangeListeners(): Unit