Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-565

Support Set data type

      Add support for Dictionary/Hashmap. See https://github.com/realm/realm-java/issues/759 for the initial discussion.

      Possible API:

      // New class
      // See API for RealmResults/RealmList for which extra methods we need
      class RealmSet<V> : Set<V> { ... }
      
      // new change listener. Should it be different than the one for Maps?
      class UnorderedCollectionChangeset {
        // Figure out API
      }
      
      // Example Usage
      open class Person : RealmObject() {
        var set: RealmSet<Dog> = RealmSet()
      }
      val person = realm.createObject<Person>()
      person.set.addChangelistener { set, changeset ->
        // Handle changes to set
      }
      

      TODO (probably not complete):

      • [ ] Determine possible API. Ideally, we should be able to store all supported Realm types as both keys and values
      • [ ] New callback type: UnorderedCollectionChangeset. Determine API.
      • [ ] Add support for RealmResults.setSet(set)
      • [ ] Add support for DynamicRealmObject.setSet(set)/DynamicRealmObject.getSet().
      • [ ] Add support in RealmFieldType
      • [ ] Add support in RealmObjectSchema
      • [ ] Add support in RealmQuery. Which types of queries should be supported? containsValue ?
      • [ ] copyToRealm
      • [ ] copyToRealmOrUpdate
      • [ ] insert
      • [ ] insertOrUpdate
      • [ ] copyFromRealm
      • [ ] How should sets be supported in JSON? Like Arrays?
      • [ ] createObjectFromJson(Class, InputStream)
      • [ ] createObjectFromJson(Class, JSONObject)
      • [ ] createObjectFromJson(Class, String)
      • [ ] createOrUpdateObjectFromJson(Class, InputStream)
      • [ ] createOrUpdateObjectFromJson(Class, JSONObject)
      • [ ] createOrUpdateObjectFromJson(Class, String)
      • [ ] createAllFromJson(Class, InputStream)
      • [ ] createAllFromJson(Class, JSONArray)
      • [ ] createAllFromJson(Class, String)
      • [ ] createOrUpdateAllFromJson(Class, InputStream)
      • [ ] createOrUpdateAllFromJson(Class, JSONArray)
      • [ ] createOrUpdateAllFromJson(Class, String)

      See https://github.com/realm/realm-java/pull/6722 for where changes need to happen

      Blocked by https://github.com/realm/realm-core/issues/3717

            Assignee:
            eduardo.lopezgutierrez@mongodb.com Eduardo López Gutiérrez (Inactive)
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: