Mark DataContainerCodecPrototype.isChoice() for removal 35/99835/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 21 Feb 2022 17:04:44 +0000 (18:04 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 22 Feb 2022 09:47:58 +0000 (10:47 +0100)
This is an internal remnant from when we did not have a ChoiceIn
intermediate class. Mark it for removal.

JIRA: MDSAL-696
Change-Id: I50217ccfd6ff4c6c7db58e1085fa253779732e8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/DataContainerCodecPrototype.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/DataObjectCodecContext.java

index a88869e16fa983cadf576aab7cf2a677a05e5f38..542238eb0f680be2951d59adc7a982628ecca40f 100644 (file)
@@ -247,6 +247,7 @@ final class DataContainerCodecPrototype<T extends WithStatus> implements NodeCon
         throw new IllegalArgumentException("Unsupported type " + getBindingClass() + " " + schema);
     }
 
+    // FIXME: eliminate with above createInstance() item
     boolean isChoice() {
         return schema instanceof ChoiceSchemaNode;
     }
index ff05f546b17c8c54b71986a9d3755b81a31a869a..fd1c2eea8bd9ee66a94922fbd777e740d8f4c5d6 100644 (file)
@@ -126,9 +126,13 @@ public abstract class DataObjectCodecContext<D extends DataObject, T extends Dat
             }
 
             final DataContainerCodecPrototype<?> childProto = loadChildPrototype(retClass);
-            tmpDataObjects.put(method, childProto.getBindingClass());
-            byStreamClassBuilder.put(childProto.getBindingClass(), childProto);
+            final Class<?> childClass = childProto.getBindingClass();
+            tmpDataObjects.put(method, childClass);
+            byStreamClassBuilder.put(childClass, childProto);
             byYangBuilder.put(childProto.getYangArg(), childProto);
+
+            // FIXME: It really feels like we should be specializing DataContainerCodecPrototype so as to ditch
+            //        createInstance() and then we could do an instanceof check instead.
             if (childProto.isChoice()) {
                 final ChoiceNodeCodecContext<?> choice = (ChoiceNodeCodecContext<?>) childProto.get();
                 for (final Class<?> cazeChild : choice.getCaseChildrenClasses()) {