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

Extensions for io.realm.RealmModel

deleteFromRealm

fun RealmModel.deleteFromRealm(): Unit

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

isLoaded

fun RealmModel.isLoaded(): Boolean

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

isManaged

fun RealmModel.isManaged(): Boolean

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.

isValid

fun RealmModel.isValid(): Boolean

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.

load

fun RealmModel.load(): Boolean

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

removeAllChangeListeners

fun RealmModel.removeAllChangeListeners(): Unit

Removes all registered listeners from the given RealmObject.