How can i create Model object with out extending RealmObject, Because I am already extended Resource from JSONAPI2


#1

Here is sample

@JsonApi(type = “countries”)
public class Countries extends Resource implements Serializable {
@Json(name = “country_name”)
private String countryName;
//getters and setters …
}

I want to store Countries Object in RealM.
Can some one explain how can i store in RealM DB?
Thanks in Advance.


#2

RealmObjects can only inherit interfaces, but they cannot extend other classes.

Seems like you’ll need to have separate classes for your API definition and your Realm objects.

A good thing, considering the match between API and local DB schema tends to be purely coincidental, and eventually diverge.