-
Type: Improvement
-
Resolution: Done
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
6842
-
SDK FY21-Q3, SDK FY21-Q3.
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