X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-model-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fmodel%2Fapi%2FModuleImport.java;h=4a135bb4a2d6d8d6098fd665fd2786c6d9549cd2;hb=17afba7c6d9848bb61d4c550cc17b9a1a7cbe2c8;hp=dbad2094793d54d011783e798b4cc0578f06c3bf;hpb=891817dd764184f4986e9f2f3ad7c29af55a9249;p=yangtools.git diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ModuleImport.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ModuleImport.java index dbad209479..4a135bb4a2 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ModuleImport.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ModuleImport.java @@ -7,30 +7,37 @@ */ package org.opendaylight.yangtools.yang.model.api; -import java.util.Date; import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.concepts.SemVer; +import org.opendaylight.yangtools.yang.common.Revision; +import org.opendaylight.yangtools.yang.model.api.stmt.ImportEffectiveStatement; /** - * Interface describing YANG 'import' statement. - * - *

- * The import statement makes definitions from one module available inside another module or submodule. + * Interface describing YANG 'import' statement. The import statement makes definitions from one module available inside + * another module or submodule. */ -public interface ModuleImport extends DocumentedNode { +// FIXME: 7.0.0: this class is a leak of the declared world into the effective one. In effective world, all nodes form +// a tree, which consists of multiple (mostly) QName-navigated namespaces. As such module imports +// contribute only a prefix/QNameModule mapping to the effective world and hence should be mapped that +// way: +// - Module exposes String->QNameModule mapping +public interface ModuleImport extends DocumentedNode, EffectiveStatementEquivalent { /** * Returns the name of the module to import. * * @return Name of the module to import */ - String getModuleName(); + default @NonNull String getModuleName() { + return asEffectiveStatement().argument(); + } /** * Returns the module revision to import. May be null. * * @return Revision of module to import */ - Optional getRevision(); + Optional getRevision(); /** * Returns the semantic version to import. @@ -44,5 +51,5 @@ public interface ModuleImport extends DocumentedNode { * * @return Prefix used to point to imported module */ - String getPrefix(); + @NonNull String getPrefix(); }