2 * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.model.api.stmt;
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.model.api.YangStmtMapping;
14 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
15 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
18 * Effective view of a {@link ModuleStatement}.
21 // FIXME: 6.0.0: we should reshuffle the String here, as module name is in reality a YANG identifier, e.g. not just
22 // an ordinary String. We really want this to be a QName, so that we do not need the localQNameModule
23 // bit, but that may be problematic with ModuleStatement, which is getting created before we even know
24 // the namespace :( A type capture of the string may just be sufficient.
25 public interface ModuleEffectiveStatement extends DataTreeAwareEffectiveStatement<String, ModuleStatement> {
27 * Namespace mapping all known prefixes in a module to their modules. Note this namespace includes the module
28 * in which it is instantiated.
30 abstract class PrefixToEffectiveModuleNamespace
31 implements IdentifierNamespace<String, @NonNull ModuleEffectiveStatement> {
32 private PrefixToEffectiveModuleNamespace() {
33 // This class should never be subclassed
38 * Namespace mapping all known {@link QNameModule}s to their encoding prefixes. This includes the declaration
39 * from prefix/namespace/revision and all imports as they were resolved.
41 abstract class QNameModuleToPrefixNamespace implements IdentifierNamespace<QNameModule, @NonNull String> {
42 private QNameModuleToPrefixNamespace() {
43 // This class should never be subclassed
48 * Namespace mapping all included submodules. The namespaces is keyed by submodule name.
50 abstract class NameToEffectiveSubmoduleNamespace
51 implements IdentifierNamespace<String, @NonNull SubmoduleEffectiveStatement> {
52 private NameToEffectiveSubmoduleNamespace() {
53 // This class should never be subclassed
58 default StatementDefinition statementDefinition() {
59 return YangStmtMapping.MODULE;
63 * Get the local QNameModule of this module. All implementations need to override this default method.
65 * @return Local QNameModule
67 @NonNull QNameModule localQNameModule();