Refactor augment statement implementation
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / Module.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 java.net.URI;
11 import java.util.Collection;
12 import java.util.Optional;
13 import org.opendaylight.yangtools.concepts.Immutable;
14 import org.opendaylight.yangtools.concepts.SemVer;
15 import org.opendaylight.yangtools.yang.common.QNameModule;
16 import org.opendaylight.yangtools.yang.common.Revision;
17 import org.opendaylight.yangtools.yang.common.YangVersion;
18
19 /**
20  * This interface contains the methods for getting the data from the YANG module.
21  */
22 public interface Module extends DataNodeContainer, DocumentedNode, Immutable, NotificationNodeContainer,
23         NamespaceRevisionAware {
24     /**
25      * Returns the name of the module which is specified as argument of YANG {@code module} statement.
26      *
27      * @return string with the name of the module
28      */
29     String getName();
30
31     /**
32      * Returns a {@link QNameModule}, which contains the namespace and the revision of the module.
33      *
34      * @return QNameModule identifier.
35      */
36     QNameModule getQNameModule();
37
38     /**
39      * Returns the namespace of the module which is specified as argument of YANG {@code namespace}
40      * keyword. If you need both namespace and revision, please consider using {@link #getQNameModule()}.
41      *
42      * @return URI format of the namespace of the module
43      */
44     @Override
45     default URI getNamespace() {
46         return getQNameModule().getNamespace();
47     }
48
49     /**
50      * Returns the revision date for the module. If you need both namespace and
51      * revision, please consider using {@link #getQNameModule()}.
52      *
53      * @return date of the module revision which is specified as argument of YANG {@code revison} statement
54      */
55     @Override
56     default Optional<Revision> getRevision() {
57         return getQNameModule().getRevision();
58     }
59
60     /**
61      * Returns the semantic version of YANG module. If the semantic version is not specified, default semantic version
62      * of module is returned.
63      *
64      * @return SemVer semantic version of YANG module which is specified as argument of
65      *         {@code (urn:opendaylight:yang:extension:semantic-version?revision=2016-02-02)semantic-version} statement
66      */
67     Optional<SemVer> getSemanticVersion();
68
69     /**
70      * Returns the prefix of the module.
71      *
72      * @return string with the module prefix which is specified as argument of YANG {@code prefix} statement
73      */
74     String getPrefix();
75
76     /**
77      * Returns the YANG version.
78      *
79      * @return YANG version of this module.
80      */
81     YangVersion getYangVersion();
82
83     /**
84      * Returns the module organization.
85      *
86      * @return string with the name of the organization specified in the module as the argument of YANG
87      *         {@code organization} statement
88      */
89     Optional<String> getOrganization();
90
91     /**
92      * Returns the module contact.
93      *
94      * <p>
95      * The contact represents the person or persons to whom technical queries concerning this module should be sent,
96      * such as their name, postal address, telephone number, and electronic mail address.
97      *
98      * @return string with the contact data specified in the module as the argument of YANG {@code contact} statement
99      */
100     Optional<String> getContact();
101
102     /**
103      * Returns imports which represents YANG modules which are imported to this module via {@code import} statement.
104      *
105      * @return set of module imports which are specified in the module as the argument of YANG {@code import}
106      *         statements.
107      */
108     Collection<? extends ModuleImport> getImports();
109
110     Collection<? extends Module> getSubmodules();
111
112     /**
113      * Returns {@link FeatureDefinition} instances which contain data from {@code feature} statements defined in the
114      * module.
115      *
116      * <p>
117      * The feature is used to define a mechanism by which portions of the schema are marked as conditional.
118      *
119      * @return feature statements in lexicographical order which are specified in the module as the argument of YANG
120      *         {@code feature} statements.
121      */
122     Collection<? extends FeatureDefinition> getFeatures();
123
124     /**
125      * Returns {@link AugmentationSchemaNode} instances which contain data from {@code augment} statements defined
126      * in the module.
127      *
128      * @return set of the augmentation schema instances which are specified in the module as YANG {@code augment}
129      *         statement and are lexicographically ordered
130      */
131     Collection<? extends AugmentationSchemaNode> getAugmentations();
132
133     /**
134      * Returns {@link RpcDefinition} instances which contain data from {@code rpc} statements defined in the module.
135      *
136      * @return set of the RPC definition instances which are specified in the module as YANG {@code rpc} statements and
137      *         are lexicographicaly ordered
138      */
139     Collection<? extends RpcDefinition> getRpcs();
140
141     /**
142      * Returns {@link Deviation} instances which contain data from {@code deviation} statements defined in the module.
143      *
144      * @return set of the deviation instances
145      */
146     Collection<? extends Deviation> getDeviations();
147
148     /**
149      * Returns {@link IdentitySchemaNode} instances which contain data from {@code identity} statements defined in the
150      * module.
151      *
152      * @return set of identity schema node instances which are specified in the module as YANG {@code identity}
153      *         statements and are lexicographically ordered
154      */
155     Collection<? extends IdentitySchemaNode> getIdentities();
156
157     /**
158      * Returns {@link ExtensionDefinition} instances which contain data from {@code extension} statements defined in
159      * the module.
160      *
161      * @return set of extension definition instances which are specified in the module as YANG {@code extension}
162      *         statements and are lexicographically ordered
163      */
164     Collection<? extends ExtensionDefinition> getExtensionSchemaNodes();
165 }