Merge "Add Anyxml normalized node to yang-data-api."
authorTony Tkacik <ttkacik@cisco.com>
Wed, 18 Jun 2014 10:15:09 +0000 (10:15 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 18 Jun 2014 10:15:09 +0000 (10:15 +0000)
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();
+}