Deprecate getSemanticVersion() for removal
[yangtools.git] / model / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / ModuleImport.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.util.Optional;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.concepts.SemVer;
13 import org.opendaylight.yangtools.yang.common.Revision;
14 import org.opendaylight.yangtools.yang.model.api.stmt.ImportEffectiveStatement;
15
16 /**
17  * Interface describing YANG 'import' statement. The import statement makes definitions from one module available inside
18  * another module or submodule.
19  */
20 // FIXME: 7.0.0: this class is a leak of the declared world into the effective one. In effective world, all nodes form
21 //               a tree, which consists of multiple (mostly) QName-navigated namespaces. As such module imports
22 //               contribute only a prefix/QNameModule mapping to the effective world and hence should be mapped that
23 //               way:
24 //               - Module exposes String->QNameModule mapping
25 public interface ModuleImport extends DocumentedNode, EffectiveStatementEquivalent<ImportEffectiveStatement> {
26     /**
27      * Returns the name of the module to import.
28      *
29      * @return Name of the module to import
30      */
31     default @NonNull String getModuleName() {
32         return asEffectiveStatement().argument();
33     }
34
35     /**
36      * Returns the module revision to import. May be null.
37      *
38      * @return Revision of module to import
39      */
40     Optional<Revision> getRevision();
41
42     /**
43      * Returns the semantic version to import.
44      *
45      * @return Semantic version of module to import
46      * @deprecated Semantic version imports are deprecated.
47      */
48     @Deprecated(since = "8.0.4", forRemoval = true)
49     Optional<SemVer> getSemanticVersion();
50
51     /**
52      * Returns the prefix associated with the imported module.
53      *
54      * @return Prefix used to point to imported module
55      */
56     @NonNull String getPrefix();
57 }