我在java中为Realm编写一个包装类。我可以通过在类中使用相同的名称和变量数据类型将Plain Object转换为RealmObject吗? 例如
public class Person {
private String name;
private int age;
public int getAge() { return age; }
public void setAge(int age) { this.age = age; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
要
public class RelamPerson extends RealmObject{
private String name;
private int age;
public int getAge() { return age; }
public void setAge(int age) { this.age = age; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}