vertigo-core
vertigo-core copied to clipboard
ListVAccessor.get() should return an unmodifiable DtList
Is there a point in allowing the modification of DtLists returned by the Accessor from the database ?
See example :
// after load()
final DtList<CustomObject> elements = myObject.elements().get();
final DtList<CustomObject> otherElements = otherObject.elements().get();
elements.addAll(otherElements);
In the example above, otherElements will be stacked on top of elements every time the code runs, which is probably not the desired outcome since myObject.elements().get() is expected to be pristine data.
ListVAccessor.get() could return an unmodifiable DtList instead.
Even more dangerous if myObject is a ref element shared by all threads. A buggy code in one place can mess up all.