Bug 2906 - Added support of entering notification by #streamChild()
authorTony Tkacik <ttkacik@cisco.com>
Fri, 27 Mar 2015 10:04:50 +0000 (11:04 +0100)
committerTony Tkacik <ttkacik@cisco.com>
Fri, 27 Mar 2015 10:34:09 +0000 (11:34 +0100)
Root Tree Node context did not allowed to enter notification
using binding classes by #streamChild method, since
notifications were cached in different collection.

Added support for entering notifications using such method.

Change-Id: I28779e763a81519d25d71e319776cdc6f179ef33
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
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);
     }