Closed AdamGrzybkowski closed 6 years ago
Hi @AdamGrzybkowski, I have never use RealmModel, but I think it could be an interesting feature. I will try to prepare some examples to see how it works!
@vicpinm After I've created this issue I tried to do it as proof of concept. You can check it here https://github.com/AdamGrzybkowski/Kotlin-Realm-Extensions/commit/32df7cf0e9360e72800525ab84b8ef092030865e
It should be pretty simple because RealmObject is implementing RealmModel. The only difference is when you want to check e.g. if object is valid or managed.
Thanks you so much @AdamGrzybkowski, I will look into it next week! I also have to see how it works with new realm version 4.0.
The RealmModel would work nice with Separate RealmConfiguration - that is where they are used. Something that I had on mind to add, but no time yet. It would work with https://github.com/vicpinm/Kotlin-Realm-Extensions/blob/master/library/src/main/java/com/vicpin/krealmextensions/RealmConfigStore.kt
So definition would not need to be per RealmObject's class but per RealmModel.
@magillus PR is now merged into master. A new version will be upload soon to maven.
What do you think about adding support for
RealmModel
interface?I'm not 100% sure if this would be important to other users, because even if you only implement
RealmModel
and addRealmClass
annotation you still cannot extend from different classes thenRealmObject
. But still there may be some users that prefer this approach.If you think this would be a nice to have feature I can prepare a PR to discuss :)