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 java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.common.QNameModule;
14 import org.opendaylight.yangtools.yang.common.UnqualifiedQName;
15 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
16 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
17 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
20 * Effective view of a {@link ModuleStatement}.
23 public interface ModuleEffectiveStatement
24 extends DataTreeAwareEffectiveStatement<UnqualifiedQName, ModuleStatement>, SchemaTreeRoot {
26 * Namespace mapping all known prefixes in a module to their modules. Note this namespace includes the module
27 * in which it is instantiated.
29 abstract class PrefixToEffectiveModuleNamespace
30 extends IdentifierNamespace<String, @NonNull ModuleEffectiveStatement> {
31 private PrefixToEffectiveModuleNamespace() {
32 // This class should never be subclassed
37 * Namespace mapping all known {@link QNameModule}s to their encoding prefixes. This includes the declaration
38 * from prefix/namespace/revision and all imports as they were resolved.
40 abstract class QNameModuleToPrefixNamespace extends IdentifierNamespace<QNameModule, @NonNull String> {
41 private QNameModuleToPrefixNamespace() {
42 // This class should never be subclassed
47 * Namespace mapping all included submodules. The namespaces is keyed by submodule name.
49 abstract class NameToEffectiveSubmoduleNamespace
50 extends IdentifierNamespace<String, @NonNull SubmoduleEffectiveStatement> {
51 private NameToEffectiveSubmoduleNamespace() {
52 // This class should never be subclassed
57 default StatementDefinition statementDefinition() {
58 return YangStmtMapping.MODULE;
62 * Get the local QNameModule of this module. All implementations need to override this default method.
64 * @return Local QNameModule
66 @NonNull QNameModule localQNameModule();
72 * Default implementation defers to {@link #findSchemaTreeNode(java.util.List)}.
75 default Optional<SchemaTreeEffectiveStatement<?>> findSchemaTreeNode(final SchemaNodeIdentifier path) {
76 return findSchemaTreeNode(path.getNodeIdentifiers());