I have a class Message.java
:
public class Message extends RealmObject implements Serializable {
@PrimaryKey
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("user_id")
@Expose
private User user;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
However, when saving Message
objects in Realm, I want to save them under a different class name, NotificationMessage
(which should have all the same properties and methods as the Message
class), like:
public class NotificationMessage extends Message {
}
But this doesn't seem to work. How can I create the NotificationMessage
class without copying and pasting all of the properties and methods of the Message
class?