Bug 1439, Bug 1443 Binding Codec NormalizedNodeWriter support
[mdsal.git] / code-generator / binding-data-codec / src / main / java / org / opendaylight / yangtools / binding / data / codec / impl / LeafNodeCodecContext.java
diff --git a/code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/impl/LeafNodeCodecContext.java b/code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/impl/LeafNodeCodecContext.java
new file mode 100644 (file)
index 0000000..424bd26
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.binding.data.codec.impl;
+
+import org.opendaylight.yangtools.concepts.Codec;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+class LeafNodeCodecContext extends NodeCodecContext {
+
+    private final YangInstanceIdentifier.PathArgument yangIdentifier;
+    private final Codec<Object, Object> valueCodec;
+
+    LeafNodeCodecContext(final DataSchemaNode node, final Codec<Object, Object> codec) {
+        this.yangIdentifier = new YangInstanceIdentifier.NodeIdentifier(node.getQName());
+        this.valueCodec = codec;
+    }
+
+    @Override
+    protected YangInstanceIdentifier.PathArgument getDomPathArgument() {
+        return (yangIdentifier);
+    }
+
+    protected Codec<Object, Object> getValueCodec() {
+        return valueCodec;
+    }
+
+}
\ No newline at end of file