The old implementation can only be inherited realmobject this abstract class, for some Third-party class libraries, if the same need to inherit some of the base classes, there is likely to be a conflict:
public class User extends Realmobject {
...
}
Therefore, starting with version 0.89.0, you can implement a Realmmodel interface directly and precede the class declaration with a @realmclass annotation declaration:
@RealmClass public
class User implements Realmmodel {
...
}
Then the method invoked on the Realmobject object can only be invoked in the form of a static method:
With Realmobject
User.deletefromrealm ();
User.isvalid ();
User.addchangelistener (listener);
With Realmmodel
realmobject.deletefromrealm (user);
Realmobject.isvalid (user);
Realmobject.addchangelistener (user, listener);
Refer to official documents: HTTPS://REALM.IO/DOCS/JAVA/0.89.1/#realmmodel-interface
and change log:https://github.com/realm/realm-java/blob/master/changelog.md.