Add Anyxml normalized node to yang-data-api. 71/7771/2
authorJozef Gloncak <jgloncak@cisco.com>
Tue, 17 Jun 2014 07:32:47 +0000 (09:32 +0200)
committerJozef Gloncak <jgloncak@cisco.com>
Tue, 17 Jun 2014 07:33:05 +0000 (09:33 +0200)
Proposal of anyxml normalized node interface.
This interface wraps Simple/CompositeNode as inner value.

Change-Id: Ic9c17fa28bc5eb23288162a735d890b4f77938f1
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/AnyXmlNode.java [new file with mode: 0644]

diff --git a/yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/AnyXmlNode.java b/yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/AnyXmlNode.java
new file mode 100644 (file)
index 0000000..6d89b60
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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.yang.data.api.schema;
+
+import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.Node;
+
+/**
+ * Anyxml normalizedNode.
+ *
+ * <p>
+ * This node contains values for anyxml as either SimpleNode or CompositeNode.
+ * The concrete value depends on the current value of anyxml node.
+ * </p>
+ *
+ * <p>
+ * For yang node: anyxml foo;
+ *
+ * <ul>
+ * <li>
+ * with xml value:
+ * <pre>
+ * {@code <foo>justSomeString</foo>}
+ * </pre>
+ * </li>
+ *
+ * this AnyXmlNode returns SimpleNode with QName{namespace=someNamespace, revision=someRevision, localName=foo} and value="justSomeString"
+ *
+ * <li>
+ * but with xml value:
+ * <pre>
+ * {@code <foo><bar>stringInXml</bar></foo>}
+ * </pre>
+ * </li>
+ *
+ * this AnyXmlNode returns CompositeNode with QName{}namespace=someNamespace, revision=someRevision, localName=foo}
+ * and values [SimpleNode with QName{}namespace=someNamespace, revision=someRevision, localName=bar} and value="stringInXml"]
+ * </ul>
+ * </p>
+ */
+public interface AnyXmlNode extends AttributesContainer, DataContainerChild<NodeIdentifier, Node<?>> {
+
+    @Override
+    NodeIdentifier getIdentifier();
+
+    /**
+     * @return anyxml node value represented as SimpleNode or CompositeNode.
+     * Returned node contains top level element that duplicates the anyxml node.
+     */
+    @Override
+    Node<?> getValue();
+}