Is there any use for implementing RealmModel instead of extending RealmObject to Realm?

In Realm , for an object to be saved, it must either implement RealmModel or extend RealmObject . Are there any advantages to using one over the other?

All that says in realm docs :

An alternative to extending the RealmObject base class is to implement the RealmModel interface and add the @RealmClass annotation.

All methods available in RealmObject are available through static methods.

+7
java android realm
source share
1 answer

Considering that extending any classes not RealmObject impossible, even if you implement RealmModel and add @RealmClass , in my opinion, you just get additional complexity, forcing yourself to use, for example, RealmObject.isValid(realmObject) instead of realmObject.isValid() , which You will get naturally free using extends RealmObject .

No, you should stick with the RealmObject extension. Using implements RealmModel does not give you additional benefits.

+2
source share

All Articles