I am using realm.io in Android. I just started using realm so my question is bit basic. I want to know
Thanks
答案 0 :(得分:0)
这实际上取决于你想要如何实现它。
您可以将函数包装为
public static void setValue(Something something, int value) {
value = value + 42;
something.setValue(value);
}
realm.beginTransaction();
setValue(something, 42);
realm.commitTransaction();
或者您可以使用setter来包装逻辑,如:
public class Something extends RealmObject {
private int value;
public void setValue(int value) {
value = value + 42;
this.value = value;
}
}
吸气剂类似。