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

Split out immutable NormalizedNode implementations

    XMLWordPrintable

Details

    • Task
    • Status: Resolved
    • High
    • Resolution: Done
    • None
    • 12.0.0
    • data-impl

    Description

      Many yang-data-api users are interested only in the immutable NormalizedNode implementation hosted in yang-data-impl. Split it out to yang-data-spi, so it can be used independently of others.

      This also entails dealing with Builders and ImmutableNodes classes. The new artifact should only have ImmutableNodes, which provides a superset of methods from Builders and ImmutableNodes.

      Furthermore OrderingAware constructs, like MapNode and LeafListNode should have three basic builder factories:

      class ImmutableNodes {
          public static CollectionNodeBuilder<MapEntryNode, ? extends MapNode> mapBuilder(Ordering ordering) {
              return switch (ordering) {
                  case SYSTEM -> systemMapBuilder();
                  case USER -> userMapBuilder();
              };
          }
      
          public static CollectionNodeBuilder<MapEntryNode, SystemMapNode> systemMapBuilder() {
              return ImmutableMapNodeBuilder.create();
          }
      
          public static CollectionNodeBuilder<MapEntryNode, UserMapNode> userMapBuilder() {
              return ImmutableUserMapNodeBuilder.create();
          }
      }
      

      Access to individual builders is mediated through NormalizedNode.BuilderFactory and the shapes of builders dictated by NormalizedNode.Builder interface hierarchy.

      Attachments

        Issue Links

          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: