Add utility wrappers for instantiating builders/nodes
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / SchemaAwareApplyOperation.java
index 936877add392304755b7c5f8fc2faf901fe86256..efc78d75874c9657bba6a32764ac56f26be870a0 100644 (file)
@@ -85,10 +85,8 @@ abstract class SchemaAwareApplyOperation extends ModificationApplyOperation {
         final SchemaAwareApplyOperation op;
         if (keyDefinition == null || keyDefinition.isEmpty()) {
             op = new UnkeyedListModificationStrategy(schemaNode, treeConfig);
-        } else if (schemaNode.isUserOrdered()) {
-            op = new OrderedMapModificationStrategy(schemaNode, treeConfig);
         } else {
-            op = new UnorderedMapModificationStrategy(schemaNode, treeConfig);
+            op = MapModificationStrategy.of(schemaNode, treeConfig);
         }
 
         return MinMaxElementsValidation.from(op, schemaNode);
@@ -96,13 +94,7 @@ abstract class SchemaAwareApplyOperation extends ModificationApplyOperation {
 
     private static ModificationApplyOperation fromLeafListSchemaNode(final LeafListSchemaNode schemaNode,
             final DataTreeConfiguration treeConfig) {
-        final SchemaAwareApplyOperation op;
-        if (schemaNode.isUserOrdered()) {
-            op = new OrderedLeafSetModificationStrategy(schemaNode, treeConfig);
-        } else {
-            op = new UnorderedLeafSetModificationStrategy(schemaNode, treeConfig);
-        }
-        return MinMaxElementsValidation.from(op, schemaNode);
+        return MinMaxElementsValidation.from(new LeafSetModificationStrategy(schemaNode, treeConfig), schemaNode);
     }
 
     protected static void checkNotConflicting(final ModificationPath path, final TreeNode original,
@@ -189,11 +181,6 @@ abstract class SchemaAwareApplyOperation extends ModificationApplyOperation {
         }
     }
 
-    @Override
-    protected ChildTrackingPolicy getChildPolicy() {
-        return ChildTrackingPolicy.UNORDERED;
-    }
-
     @Override
     Optional<TreeNode> apply(final ModifiedNode modification, final Optional<TreeNode> currentMeta,
             final Version version) {