Bug 2924: DataCodecTree expose (de)serialization methods for path arguments.
[mdsal.git] / code-generator / binding-data-codec / src / main / java / org / opendaylight / yangtools / binding / data / codec / impl / KeyedListNodeCodecContext.java
index a5b2a97f980ee7617284da394d5c87beacd85ee0..865a4ed478f1338790224eb7d21976ab7146649a 100644 (file)
@@ -79,4 +79,22 @@ final class KeyedListNodeCodecContext<D extends DataObject & Identifiable<?>> ex
     NodeIdentifierWithPredicates serialize(final Identifier<?> key) {
         return codec.serialize(new IdentifiableItem(getBindingClass(), key));
     }
+
+    @Override
+    public YangInstanceIdentifier.PathArgument serializePathArgument(InstanceIdentifier.PathArgument arg) {
+        if(arg instanceof IdentifiableItem) {
+            return codec.serialize((IdentifiableItem<?,?>) arg);
+        }
+        return super.serializePathArgument(arg);
+    }
+
+    @Override
+    public InstanceIdentifier.PathArgument deserializePathArgument(YangInstanceIdentifier.PathArgument arg) {
+        if(arg instanceof NodeIdentifierWithPredicates) {
+            return codec.deserialize((NodeIdentifierWithPredicates) arg);
+        }
+        return super.deserializePathArgument(arg);
+    }
+
+
 }