-
Improvement
-
Resolution: Done
-
Medium
-
None
-
None
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.