Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-941

Separate out AbstractNodeContainerModificationStrategy abstract methods

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Medium
    • Resolution: Done
    • None
    • 3.0.0, 2.0.17, 2.1.9
    • data-impl
    • None

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: