Add XMLNamespace
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / stmt / ModuleEffectiveStatement.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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.stmt;
9
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.common.QNameModule;
13 import org.opendaylight.yangtools.yang.common.UnqualifiedQName;
14 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
15 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
16 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
17
18 /**
19  * Effective view of a {@link ModuleStatement}.
20  */
21 @Beta
22 public interface ModuleEffectiveStatement extends DataTreeAwareEffectiveStatement<UnqualifiedQName, ModuleStatement> {
23     /**
24      * Namespace mapping all known prefixes in a module to their modules. Note this namespace includes the module
25      * in which it is instantiated.
26      */
27     abstract class PrefixToEffectiveModuleNamespace
28             implements IdentifierNamespace<String, @NonNull ModuleEffectiveStatement> {
29         private PrefixToEffectiveModuleNamespace() {
30             // This class should never be subclassed
31         }
32     }
33
34     /**
35      * Namespace mapping all known {@link QNameModule}s to their encoding prefixes. This includes the declaration
36      * from prefix/namespace/revision and all imports as they were resolved.
37      */
38     abstract class QNameModuleToPrefixNamespace implements IdentifierNamespace<QNameModule, @NonNull String> {
39         private QNameModuleToPrefixNamespace() {
40             // This class should never be subclassed
41         }
42     }
43
44     /**
45      * Namespace mapping all included submodules. The namespaces is keyed by submodule name.
46      */
47     abstract class NameToEffectiveSubmoduleNamespace
48             implements IdentifierNamespace<String, @NonNull SubmoduleEffectiveStatement> {
49         private NameToEffectiveSubmoduleNamespace() {
50             // This class should never be subclassed
51         }
52     }
53
54     @Override
55     default StatementDefinition statementDefinition() {
56         return YangStmtMapping.MODULE;
57     }
58
59     /**
60      * Get the local QNameModule of this module. All implementations need to override this default method.
61      *
62      * @return Local QNameModule
63      */
64     @NonNull QNameModule localQNameModule();
65 }