我正在为 Realm 编写一个 Java 包装类。我可以通过在类中具有相同的名称和数据类型的变量将普通对象转换为 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; }
}