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
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.model.api;
9
10 import com.google.common.base.Optional;
11 import com.google.common.collect.ImmutableList;
12 import java.util.List;
13 import java.util.Map;
14 import java.util.Set;
15
16 /**
17  * Contains the methods for getting data and checking properties of the YANG
18  * <code>uses</code> substatement.
19  *
20  */
21 public interface UsesNode extends DocumentedNode {
22
23     /**
24      * Returns the schema path to used grouping.
25      *
26      * @return schema path to 'grouping' on which this 'uses' statement points
27      */
28     SchemaPath getGroupingPath();
29
30     /**
31      *
32      * Returns augmentations which were specified in this uses node.
33      *
34      * @return Set of augment statements defined under this uses node
35      */
36     Set<AugmentationSchema> getAugmentations();
37
38     /**
39      * Returns <code>true</code> if the data node was added by augmentation,
40      * otherwise returns <code>false</code>
41      *
42      * @return <code>true</code> if the data node was added by augmentation,
43      *         otherwise returns <code>false</code>
44      */
45     boolean isAugmenting();
46
47     /**
48      * Returns <code>true</code> if the data node was added by uses statement,
49      * otherwise returns <code>false</code>
50      *
51      * @return <code>true</code> if the data node was added by uses statement,
52      *         otherwise returns <code>false</code>
53      */
54     boolean isAddedByUses();
55
56     /**
57      * Some of the properties of each node in the grouping can be refined with
58      * the "refine" statement.
59      *
60      * @return Map, where key is schema path of refined node and value is
61      *         refined node
62      */
63     Map<SchemaPath, SchemaNode> getRefines();
64
65     /**
66      * Returns when statement
67      *
68      * If when condition is present node defined by the parent data definition
69      * statement is only valid when the returned XPath expression conceptually
70      * evaluates to "true" for a particular instance, then the node defined by
71      * the parent data definition statement is valid; otherwise, it is not.
72      *
73      * @return Optional of XPath condition
74      */
75     default Optional<RevisionAwareXPath> getWhenCondition() {
76         return Optional.absent();
77     }
78
79     /**
80      *
81      * Returns unknown schema nodes which belongs to this instance of the type
82      * <code>UsesNode</code>.
83      *
84      * @return list of unknown schema nodes defined under this uses node.
85      */
86     default List<UnknownSchemaNode> getUnknownSchemaNodes() {
87         return ImmutableList.of();
88     }
89 }