MDSAL-298: properly handle unkeyed lists
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / api / BindingCodecTreeNode.java
index 9345c2ab9bf3c3074f1ffa334165a974c1d9535b..89590630c741a15b58cee810a2d8c3747bb6069b 100644 (file)
@@ -155,4 +155,33 @@ public interface BindingCodecTreeNode<T extends DataObject> extends BindingNorma
 
     @Override
     Object getSchema();
+
+    /**
+     * Return a summary of addressability of potential children. Binding specification does not allow all DOM tree
+     * elements to be directly addressed, which means some recursive tree operations, like data tree changes do not
+     * have a one-to-one mapping from DOM to binding in all cases. This method provides an optimization hint to guide
+     * translation of data structures, allowing for fast paths when all children are known to either be addressable
+     * or non-addressable.
+     *
+     * @return Summary children addressability.
+     */
+    @Nonnull ChildAddressabilitySummary getChildAddressabilitySummary();
+
+    /**
+     * Enumeration of possible addressability attribute of all children.
+     */
+    enum ChildAddressabilitySummary {
+        /**
+         * All children are addressable.
+         */
+        ADDRESSABLE,
+        /**
+         * All children are non-addressable, including the case when this node does not have any children.
+         */
+        UNADDRESSABLE,
+        /**
+         * Mixed children, some are addressable and some are not.
+         */
+        MIXED
+    }
 }