agrestio / agrest

Server-side Java REST Framework for easy access to data graphs from various backends
https://agrest.io
Apache License 2.0
80 stars 34 forks source link

Clean up the API of EntityUpdate #636

Closed andrus closed 1 year ago

andrus commented 1 year ago

Let's clean up EntityUpdate API. Different parts of the update object (attributes, relationship ids, object id) have inconsistent method names for accessing and changing the data. We need to aligh them. Also should probably ensure that internal maps are created lazily to lighten the objects.

Upgrade Notes

EntityUpdate internal collections are no longer directly mutable, so trying to do something like update.getAttributes().put("a", 1) would result in the following exception:

java.lang.UnsupportedOperationException
    at java.base/java.util.AbstractMap.put(AbstractMap.java:209)

Instead, you should be using the new mutator methods, such as update.setAttribute("a", 1).