Using Realm for Android I have a class:
public class Entry extends RealmObject implements Parcelable {
...
}
Parcelable
interface contains methods like describeContents()
, writeToParcel()
and RealmObjects aren't supposed to have methods other than getters and setters:
Error:(81, 17) error: Only getters and setters should be defined in model classes
How can I make these two work together? Is there a better way than creating an separate class (maybe something like RealmEntry
)? Doing so would result in a lot of duplicated code.
Now there's a different workaround for that: just implement the RealmModel
interface instead of extending from RealmObject
:
@RealmClass
public class User implements RealmModel {
}
You can find more information in the Realm Documentation.