Merge "Bug 2906 - Added support of entering notification by #streamChild()"
authorRobert Varga <nite@hq.sk>
Fri, 27 Mar 2015 10:52:48 +0000 (10:52 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 27 Mar 2015 10:52:48 +0000 (10:52 +0000)
code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/impl/SchemaRootCodecContext.java

index 681b7906ed06a359b5d232013e833e1ed95ac5c3..ff8310266c25781b24c9c670ae9bed6421527304 100644 (file)
@@ -126,6 +126,14 @@ final class SchemaRootCodecContext<D extends DataObject> extends DataContainerCo
     @Override
     public <DV extends DataObject> DataContainerCodecContext<DV, ?> streamChild(Class<DV> childClass)
             throws IllegalArgumentException {
+        /* FIXME: This is still not solved for RPCs
+         * TODO: Probably performance wise RPC, Data and Notification loading cache
+         *       should be merge for performance resons. Needs microbenchmark to
+         *       determine which is faster (keeping them separate or in same cache).
+         */
+        if (Notification.class.isAssignableFrom(childClass)) {
+            return (DataContainerCodecContext<DV, ?>) getNotification((Class<? extends Notification>)childClass);
+        }
         return (DataContainerCodecContext<DV, ?>) childrenByClass.getUnchecked(childClass);
     }