Migrate getDataChildByName() users
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / ImmutableNodes.java
index 84459e948ca279b1c772ebb3624b883824f15ee5..5a96515d13da23583dae2dcaee0ee40d7f65f3d9 100644 (file)
@@ -38,10 +38,11 @@ import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public final class ImmutableNodes {
+    // FIXME: YANGTOOLS-1074: we do not want this name
     private static final NodeIdentifier SCHEMACONTEXT_NAME = NodeIdentifier.create(SchemaContext.NAME);
 
     private ImmutableNodes() {
-        throw new UnsupportedOperationException("Utilities class should not be instantiated");
+        // Hidden on purpose
     }
 
     public static @NonNull CollectionNodeBuilder<MapEntryNode, MapNode> mapNodeBuilder() {
@@ -105,10 +106,7 @@ public final class ImmutableNodes {
      * @return Leaf node with supplied identifier and value
      */
     public static <T> @NonNull LeafNode<T> leafNode(final NodeIdentifier name, final T value) {
-        return ImmutableLeafNodeBuilder.<T>create()
-                .withNodeIdentifier(name)
-                .withValue(value)
-                .build();
+        return ImmutableLeafNodeBuilder.createNode(name, value);
     }
 
     /**
@@ -126,7 +124,7 @@ public final class ImmutableNodes {
     public static @NonNull DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder(
             final QName nodeName, final QName keyName, final Object keyValue) {
         return ImmutableMapEntryNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifierWithPredicates(nodeName, keyName, keyValue))
+                .withNodeIdentifier(NodeIdentifierWithPredicates.of(nodeName, keyName, keyValue))
                 .withChild(leafNode(keyName, keyValue));
     }
 
@@ -241,7 +239,7 @@ public final class ImmutableNodes {
         final Iterator<PathArgument> it = id.getPathArguments().iterator();
         if (it.hasNext()) {
             topLevelElement = it.next();
-            final DataSchemaNode dataChildByName = ctx.getDataChildByName(topLevelElement.getNodeType());
+            final DataSchemaNode dataChildByName = ctx.dataChildByName(topLevelElement.getNodeType());
             checkNotNull(dataChildByName,
                 "Cannot find %s node in schema context. Instance identifier has to start from root", topLevelElement);
             instanceIdToNodes = InstanceIdToNodes.fromSchemaAndQNameChecked(ctx, topLevelElement.getNodeType());