我有一些课程"模型"
@PrimaryKey
private int id;
private Boolean value1;
private Boolean value2;
public Boolean getValue1() {
return value1;
}
public void setValue1(Boolean value1) {
this.value1 = value1;
}
public Boolean getValue2() {
return value2;
}
public void setValue2(Boolean value2) {
this.value2 = value2;
}
public String toString() {
return "value1 = " + getValue1() + " value2 = " + getValue2();
}
从某些API响应中,某些字段可能为NULL,但它是正确的。我需要的是:如果来自API的模型不包含某些字段,则realm应该忽略他,并且不会在数据库中保存NULL。可能吗?
感谢。