BUG-6533: add immutable implementations of yang.model.api
[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 java.util.Map;
12 import java.util.Set;
13 import javax.annotation.Nonnull;
14
15 /**
16  * Contains the methods for getting data and checking properties of the YANG
17  * <code>uses</code> substatement.
18  */
19 public interface UsesNode extends DocumentedNode.WithStatus {
20
21     /**
22      * Returns the schema path to used grouping.
23      *
24      * @return schema path to 'grouping' on which this 'uses' statement points
25      */
26     @Nonnull SchemaPath getGroupingPath();
27
28     /**
29      *
30      * Returns augmentations which were specified in this uses node.
31      *
32      * @return Set of augment statements defined under this uses node
33      */
34     @Nonnull Set<AugmentationSchema> getAugmentations();
35
36     /**
37      * Returns <code>true</code> if the data node was added by augmentation,
38      * otherwise returns <code>false</code>
39      *
40      * @return <code>true</code> if the data node was added by augmentation,
41      *         otherwise returns <code>false</code>
42      */
43     boolean isAugmenting();
44
45     /**
46      * Returns <code>true</code> if the data node was added by uses statement,
47      * otherwise returns <code>false</code>
48      *
49      * @return <code>true</code> if the data node was added by uses statement,
50      *         otherwise returns <code>false</code>
51      */
52     boolean isAddedByUses();
53
54     /**
55      * Some of the properties of each node in the grouping can be refined with
56      * the "refine" statement.
57      *
58      * @return Map, where key is schema path of refined node and value is
59      *         refined node
60      */
61     @Nonnull Map<SchemaPath, SchemaNode> getRefines();
62
63     /**
64      * Returns when statement
65      *
66      * If when condition is present node defined by the parent data definition
67      * statement is only valid when the returned XPath expression conceptually
68      * evaluates to "true" for a particular instance, then the node defined by
69      * the parent data definition statement is valid; otherwise, it is not.
70      *
71      * @return Optional of XPath condition
72      */
73     default @Nonnull Optional<RevisionAwareXPath> getWhenCondition() {
74         return Optional.absent();
75     }
76 }