Disconnect EncapsulatedValueCodec from ReflectionBasedCodec
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / impl / TypeObjectNormalizedNodeCache.java
index 75cf553f8e638166e1483449969488fc6193f306..9c08d450557a929e4e80edade915db77d045e8a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -7,22 +7,21 @@
  */
 package org.opendaylight.mdsal.binding.dom.codec.impl;
 
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingTypeObjectCodecTreeNode;
 import org.opendaylight.yangtools.yang.binding.TypeObject;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 
 /**
  * A cache of NormalizedNodes corresponding to a particular TypeObject instantiation.
  */
-final class TypeObjectNormalizedNodeCache
-        extends AbstractBindingNormalizedNodeCache<TypeObject, ValueNodeCodecContext> {
-    TypeObjectNormalizedNodeCache(final ValueNodeCodecContext rootContext) {
+final class TypeObjectNormalizedNodeCache<C extends NodeCodecContext & BindingTypeObjectCodecTreeNode<TypeObject>>
+        extends AbstractBindingNormalizedNodeCache<TypeObject, C> {
+    TypeObjectNormalizedNodeCache(final C rootContext) {
         super(rootContext);
     }
 
     @Override
-    public NormalizedNode<?, ?> load(final TypeObject key) {
-        return ImmutableNodes.leafNode(rootContext().getDomPathArgument(),
-            rootContext().getValueCodec().serialize(key));
+    public NormalizedNode load(final TypeObject key) {
+        return rootContext().serialize(key);
     }
 }