Uploaded image for project: 'Realm Kotlin'
  1. Realm Kotlin
  2. RKOTLIN-378

Expose `getRealm()` on RealmObject, RealmResults, RealmList

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Local
    • None

      In Realm Java we expose a getRealm() method on Objects, Results and Lists. The reason being that in very modular code, you avoid having to pass around the pair of (Realm, Object).

      This was particular relevant in Java where the Realm might be thread-confined.
      In Kotlin, the Realm can be a global singleton so there is less need for it, but I still ran into a use case for why we probably want to do it anyway: Extension functions.

      Since they live in complete isolation, being able to find the Realm from any Realm object seems pretty useful. My use case was wanting to create an {{object.write { }}} method.

            Assignee:
            Unassigned Unassigned
            Reporter:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: