-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Right now a set-record method copies the content of a record but does not change its reference pointer to the copies record. This seems counterintuitive to vanilla java.
Sample13 obj = Records.create(blueprintId);
Bar bar = obj.getBar();
bar.setFraction(0.1f);
// prints -> obj: {bar: {fraction: 0.1}}
Sample13 otherObj = Records.create(blueprintId);
otherObj.setBar(bar);
// prints -> otherObj: {bar: {fraction: 0.1}}
bar.setFraction(0.5f);
// prints -> obj: {bar: {fraction: 0.5}}
// prints -> otherObj: {bar: {fraction: 0.1}}It might be better to change the behavior and point the bar-view to the bar-record of the otherObj when using a set-record method. The old behavior should be accessible via a copy-record method e.g. copyBar(bar).
Maybe we should remove the set-record methods and make all views coming from get-record methods or Record.view() immutable to pointer changes. Only views from Record.resuableView() can be reused and they return true for the isReusableView() method, added to every view.