-
Improvement
-
Resolution: Done
-
High
-
None
-
None
Due to legacy reasons, the following snippet:
container foo { list bar { key baz; leaf baz { type string; } } }
ends up being mapped as this:
interface Foo {
List<Bar> getBar();
}
which ends up being nasty for multiple reasons:
- default order-by is "system", yet we are married to order-dependent List.equals(), yet
- the BI layer will interpret this as a freely-reorderable Map
- there is no provision to look up elements by their key and hence users must perform linear searches
The mapping for keyed lists with "order-by system", the mapping should result in the following:
interface Foo {
Map<BarKey, Bar> getBar();
}
which properly captures the contract here, binding use to Map.equals(). Note that unkeyed lists must not be affected, nor should the "order-by user" lists be changed.
For dealing with user-ordered lists we will need a custom interface, which is an extension of List and provides a secondary map-like lookups, still deriving equality from List.equals().
- relates to
-
MDSAL-540 Remove compatibility Builder.setFoo(List<Foo>)
- Resolved