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

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: 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
            Reporter:
            Christian Melchior (Inactive)
            Archiver:
            Marc Greenfield

              Created:
              Updated:
              Resolved:
              Archived: