[YANGTOOLS-941] Separate out AbstractNodeContainerModificationStrategy abstract methods Created: 29/Jan/19  Updated: 04/Feb/19  Resolved: 04/Feb/19

Status: Resolved
Project: yangtools
Component/s: data-impl
Affects Version/s: None
Fix Version/s: 3.0.0, 2.0.17, 2.1.9

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: unlabeled-YANGTOOLS-940

 Description   

AbstractNodeContainerModificationStrategy currently requires subclassing to provide two methods:

  • createEmptyValue()
  • createBuilder()

All these methods perform the same basic thing: they check argument type and invoke a a builder method, with some special-casing to handle top-level map nodes.

It seems we could easily provide a base class, which would dispatch to based on a method handle (or similar). This would reduce the need to subclass the strategy, simply by providing a common object to implement these methods. Two distinct implementations with 9 total objects, increasing the size of a particular apply strategy. For this we'll end up with a bimorphic invocation at the call site (which is merge operations, so not overly critical), which can be easily be inlined, offering a probably equally-performant-or-faster bridge.


Generated at Wed Feb 07 20:54:44 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.