Bug 5942: When condition of uses node is not exposed by the YANG parser
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / UsesNode.java
index 113767487c8fd2d53a2d4e3e28d3460e57e9da84..f825718139222ca373939820bcb77e306eaab114 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.model.api;
 
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -15,7 +18,7 @@ import java.util.Set;
  * <code>uses</code> substatement.
  *
  */
-public interface UsesNode {
+public interface UsesNode extends DocumentedNode {
 
     /**
      * Returns the schema path to used grouping.
@@ -58,4 +61,29 @@ public interface UsesNode {
      *         refined node
      */
     Map<SchemaPath, SchemaNode> getRefines();
+
+    /**
+     * Returns when statement
+     *
+     * If when condition is present node defined by the parent data definition
+     * statement is only valid when the returned XPath expression conceptually
+     * evaluates to "true" for a particular instance, then the node defined by
+     * the parent data definition statement is valid; otherwise, it is not.
+     *
+     * @return Optional of XPath condition
+     */
+    default Optional<RevisionAwareXPath> getWhenCondition() {
+        return Optional.absent();
+    }
+
+    /**
+     *
+     * Returns unknown schema nodes which belongs to this instance of the type
+     * <code>UsesNode</code>.
+     *
+     * @return list of unknown schema nodes defined under this uses node.
+     */
+    default List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return ImmutableList.of();
+    }
 }