Allow builders to optionally use LinkedHashMap 21/81821/1
authorJakub Toth <jtoth@luminanetworks.com>
Tue, 23 Apr 2019 13:46:34 +0000 (06:46 -0700)
committerRobert Varga <nite@hq.sk>
Tue, 30 Apr 2019 11:16:27 +0000 (11:16 +0000)
commit05bac6accca2fa1d852a4a9fd46770ed9d9ea61d
treec891445270d254721fcdde4b1f361d0d09553581
parentc47ffd535594cbffd31a13191cc44c4868d5ceaf
Allow builders to optionally use LinkedHashMap

Some devices are unreasonably touchy about the order of children
we send them -- i.e. they expect to encounter direct container
children before seeing any augmented children. While we push them
to NormalizedNode builders in this order, the builders are using
plain HashMaps (and rightfully so) to track them, which means
they can get reordered.

This patch introduces a new system property,
org.opendaylight.yangtools.yang.data.impl.schema.builder.retain-child-order,
which when set to "true" will cause DataContainerBuilders to use
LinkedHashMaps to track children, sacrificing efficiency to retain
the original insertion order.

JIRA: YANGTOOLS-984
Change-Id: Ica1616c3fa93559c6458eba4030a5ceaac7be58a
Signed-off-by: Jakub Toth <jtoth@luminanetworks.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6335bf3e7e821d7ec1c221ffb292000c90b0931a)
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/builder/impl/AbstractImmutableDataContainerNodeBuilder.java