Document namespace behaviours using singletons 38/65538/4
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 15 Nov 2017 10:22:48 +0000 (11:22 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 15 Nov 2017 11:32:29 +0000 (12:32 +0100)
This patch creates constants named BEHAVIOUR to hold the behaviour
for each namespace. This prevents confusion in defining the reactor
and also allows for instance reuse.

Change-Id: Ia03cbd3f8f6aac664895356d9aea89d54e2eb391
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
40 files changed:
yang/odlext-parser-support/src/main/java/org/opendaylight/yangtools/odlext/parser/AnyxmlSchemaLocationNamespace.java
yang/odlext-parser-support/src/main/java/org/opendaylight/yangtools/odlext/parser/package-info.java
yang/odlext-parser-support/src/test/java/org/opendaylight/yangtools/odlext/parser/Bug3874ExtensionTest.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/DefaultReactors.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/namespace/URIStringToImportPrefix.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/reactor/RFC7950Reactors.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/ExtensionNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/GroupingNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/IdentityNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/ModuleNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/NamespaceToModule.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/PreLinkageModuleNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/SubmoduleNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/TypeNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/DerivedIdentitiesNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/SemanticVersionModuleNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/SemanticVersionNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementDefinitionNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/AugmentToChoiceNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/BelongsToModuleContext.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/BelongsToPrefixToModuleCtx.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/BelongsToPrefixToModuleName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ImpPrefixToNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ImportPrefixToModuleCtx.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ImportPrefixToSemVerSourceIdentifier.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ImportedModuleContext.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/IncludedModuleContext.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/IncludedSubmoduleNameToModuleCtx.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleCtxToModuleQName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleCtxToSourceIdentifier.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleNameToModuleQName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleNameToNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleNamespaceForBelongsTo.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleQNameToModuleName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModulesDeviatedByModules.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/PrefixToModule.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/QNameToStatementDefinition.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/StmtOrderingNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/SupportedFeaturesNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/validation/ValidationBundlesNamespace.java

index 78609e331691fcb65134a125b14e1f6b558822a6..6c9863622edae98a9f5994aebb4927c9d74465fc 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.yangtools.odlext.parser;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.odlext.model.api.AnyxmlSchemaLocationStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
@@ -21,5 +22,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 public interface AnyxmlSchemaLocationNamespace extends IdentifierNamespace<StatementDefinition,
     Mutable<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
         EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>>> {
-    NamespaceBehaviour<?, ?, ?> BEHAVIOR = NamespaceBehaviour.treeScoped(AnyxmlSchemaLocationNamespace.class);
+    NamespaceBehaviour<StatementDefinition, Mutable<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
+        EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>>,
+        @NonNull AnyxmlSchemaLocationNamespace> BEHAVIOUR =
+            NamespaceBehaviour.treeScoped(AnyxmlSchemaLocationNamespace.class);
 }
index 09a7e1a13fa2adfd39d78061bcfa52a31a5e0573..c1aec167d94dfe94e7738cb29c957be174d733bb 100644 (file)
@@ -11,7 +11,7 @@
  * <p>
  * To access this extension, add {@link org.opendaylight.yangtools.odlext.parser.AnyxmlSchemaLocationStatementSupport},
  * {@link org.opendaylight.yangtools.odlext.parser.AnyxmlStatementSupportOverride} and
- * {@link org.opendaylight.yangtools.odlext.parser.AnyxmlSchemaLocationNamespace#BEHAVIOR} to the reactor.
+ * {@link org.opendaylight.yangtools.odlext.parser.AnyxmlSchemaLocationNamespace#BEHAVIOUR} to the reactor.
  *
  * @author Robert Varga
  */
index 41a309e36920ae722208a9847b58bc2b0696fd2a..cf83d6068e0ccf6dd0b9b2a39fbd2b5f05d7f274 100644 (file)
@@ -39,7 +39,7 @@ public class Bug3874ExtensionTest {
         reactor = RFC7950Reactors.vanillaReactorBuilder()
                 .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION,
                     AnyxmlSchemaLocationStatementSupport.getInstance())
-                .addNamespaceSupport(ModelProcessingPhase.FULL_DECLARATION, AnyxmlSchemaLocationNamespace.BEHAVIOR)
+                .addNamespaceSupport(ModelProcessingPhase.FULL_DECLARATION, AnyxmlSchemaLocationNamespace.BEHAVIOUR)
                 .overrideStatementSupport(ModelProcessingPhase.FULL_DECLARATION,
                     AnyxmlStatementSupportOverride.getInstance())
                 .build();
index b05d42da60b1d7b37db8f4771cfb30736f5f4592..03f56aea985143f71c9e4263feaa0a24ac09c0d1 100644 (file)
@@ -57,7 +57,7 @@ public final class DefaultReactors {
                 // AnyxmlSchemaLocation support
                 .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION,
                     AnyxmlSchemaLocationStatementSupport.getInstance())
-                .addNamespaceSupport(ModelProcessingPhase.FULL_DECLARATION, AnyxmlSchemaLocationNamespace.BEHAVIOR)
+                .addNamespaceSupport(ModelProcessingPhase.FULL_DECLARATION, AnyxmlSchemaLocationNamespace.BEHAVIOUR)
                 .overrideStatementSupport(ModelProcessingPhase.FULL_DECLARATION,
                     AnyxmlStatementSupportOverride.getInstance())
 
index 084fb9f25d159a817e08be90434b56f883cc06db..02c5f1f293df3f1c83d0b19c5e804a920036d7ea 100644 (file)
@@ -8,7 +8,9 @@
 package org.opendaylight.yangtools.yang.parser.rfc7950.namespace;
 
 import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Implementation-internal cache for looking up URI to import prefix. URIs are taken in as Strings to save ourselves
@@ -16,5 +18,6 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
  */
 @Beta
 public interface URIStringToImportPrefix extends IdentifierNamespace<String, String> {
-
+    NamespaceBehaviour<String, String, @NonNull URIStringToImportPrefix> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(URIStringToImportPrefix.class);
 }
index 700085ad6a32adc997c738071f2c9c3935592d72..81eb0dfdfe9e195b0a2436a3e70ea0562c87ada7 100644 (file)
@@ -9,9 +9,6 @@ package org.opendaylight.yangtools.yang.parser.rfc7950.reactor;
 
 import static org.opendaylight.yangtools.yang.common.YangVersion.VERSION_1;
 import static org.opendaylight.yangtools.yang.common.YangVersion.VERSION_1_1;
-import static org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.global;
-import static org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.sourceLocal;
-import static org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.treeScoped;
 
 import com.google.common.annotations.Beta;
 import com.google.common.collect.ImmutableMap;
@@ -165,9 +162,9 @@ public final class RFC7950Reactors {
     private static final Set<YangVersion> SUPPORTED_VERSIONS = Sets.immutableEnumSet(VERSION_1, VERSION_1_1);
 
     private static final StatementSupportBundle INIT_BUNDLE = StatementSupportBundle.builder(SUPPORTED_VERSIONS)
-            .addSupport(global(ValidationBundlesNamespace.class))
-            .addSupport(global(SupportedFeaturesNamespace.class))
-            .addSupport(global(ModulesDeviatedByModules.class))
+            .addSupport(ValidationBundlesNamespace.BEHAVIOUR)
+            .addSupport(SupportedFeaturesNamespace.BEHAVIOUR)
+            .addSupport(ModulesDeviatedByModules.BEHAVIOUR)
             .build();
 
     private static final StatementSupportBundle PRE_LINKAGE_BUNDLE = StatementSupportBundle.derivedFrom(INIT_BUNDLE)
@@ -185,10 +182,10 @@ public final class RFC7950Reactors {
             .addSupport(new YangVersionStatementSupport())
             .addSupport(new RevisionStatementSupport())
             .addSupport(new RevisionDateStatementSupport())
-            .addSupport(global(ModuleNameToNamespace.class))
-            .addSupport(global(PreLinkageModuleNamespace.class))
-            .addSupport(sourceLocal(ImpPrefixToNamespace.class))
-            .addSupport(global(ModuleCtxToModuleQName.class))
+            .addSupport(ModuleNameToNamespace.BEHAVIOUR)
+            .addSupport(PreLinkageModuleNamespace.BEHAVIOUR)
+            .addSupport(ImpPrefixToNamespace.BEHAVIOUR)
+            .addSupport(ModuleCtxToModuleQName.BEHAVIOUR)
             .build();
 
     private static final StatementSupportBundle LINKAGE_BUNDLE = StatementSupportBundle
@@ -197,24 +194,24 @@ public final class RFC7950Reactors {
             .addSupport(new ReferenceStatementSupport())
             .addSupport(new ContactStatementSupport())
             .addSupport(new OrganizationStatementSupport())
-            .addSupport(global(ModuleNamespace.class))
-            .addSupport(global(ModuleNamespaceForBelongsTo.class))
-            .addSupport(global(SubmoduleNamespace.class))
-            .addSupport(global(NamespaceToModule.class))
-            .addSupport(global(ModuleNameToModuleQName.class))
-            .addSupport(global(ModuleCtxToSourceIdentifier.class))
-            .addSupport(global(ModuleQNameToModuleName.class))
-            .addSupport(global(PrefixToModule.class))
+            .addSupport(ModuleNamespace.BEHAVIOUR)
+            .addSupport(ModuleNamespaceForBelongsTo.BEHAVIOUR)
+            .addSupport(SubmoduleNamespace.BEHAVIOUR)
+            .addSupport(NamespaceToModule.BEHAVIOUR)
+            .addSupport(ModuleNameToModuleQName.BEHAVIOUR)
+            .addSupport(ModuleCtxToSourceIdentifier.BEHAVIOUR)
+            .addSupport(ModuleQNameToModuleName.BEHAVIOUR)
+            .addSupport(PrefixToModule.BEHAVIOUR)
             .addSupport(QNameCacheNamespace.getInstance())
-            .addSupport(sourceLocal(ImportedModuleContext.class))
-            .addSupport(sourceLocal(IncludedModuleContext.class))
-            .addSupport(sourceLocal(IncludedSubmoduleNameToModuleCtx.class))
-            .addSupport(sourceLocal(ImportPrefixToModuleCtx.class))
-            .addSupport(sourceLocal(BelongsToPrefixToModuleCtx.class))
-            .addSupport(sourceLocal(URIStringToImportPrefix.class))
-            .addSupport(sourceLocal(BelongsToModuleContext.class))
-            .addSupport(sourceLocal(QNameToStatementDefinition.class))
-            .addSupport(sourceLocal(BelongsToPrefixToModuleName.class))
+            .addSupport(ImportedModuleContext.BEHAVIOUR)
+            .addSupport(IncludedModuleContext.BEHAVIOUR)
+            .addSupport(IncludedSubmoduleNameToModuleCtx.BEHAVIOUR)
+            .addSupport(ImportPrefixToModuleCtx.BEHAVIOUR)
+            .addSupport(BelongsToPrefixToModuleCtx.BEHAVIOUR)
+            .addSupport(URIStringToImportPrefix.BEHAVIOUR)
+            .addSupport(BelongsToModuleContext.BEHAVIOUR)
+            .addSupport(QNameToStatementDefinition.BEHAVIOUR)
+            .addSupport(BelongsToPrefixToModuleName.BEHAVIOUR)
             .build();
 
     private static final StatementSupportBundle STMT_DEF_BUNDLE = StatementSupportBundle
@@ -224,12 +221,12 @@ public final class RFC7950Reactors {
             .addSupport(new ExtensionStatementSupport())
             .addSupport(new ChildSchemaNodeNamespace<>())
             .addSupport(new SchemaNodeIdentifierBuildNamespace())
-            .addSupport(global(ExtensionNamespace.class))
+            .addSupport(ExtensionNamespace.BEHAVIOUR)
             .addSupport(new TypedefStatementSupport())
-            .addSupport(treeScoped(TypeNamespace.class))
+            .addSupport(TypeNamespace.BEHAVIOUR)
             .addVersionSpecificSupport(VERSION_1, new IdentityStatementRFC6020Support())
             .addVersionSpecificSupport(VERSION_1_1, new IdentityStatementRFC7950Support())
-            .addSupport(global(IdentityNamespace.class))
+            .addSupport(IdentityNamespace.BEHAVIOUR)
             .addSupport(new DefaultStatementSupport())
             .addSupport(new StatusStatementSupport())
             .addVersionSpecificSupport(VERSION_1, new TypeStatementRFC6020Support())
@@ -265,8 +262,8 @@ public final class RFC7950Reactors {
             .addVersionSpecificSupport(VERSION_1_1, new NotificationStatementRFC7950Support())
             .addSupport(new FractionDigitsStatementSupport())
             .addSupport(new BaseStatementSupport())
-            .addSupport(global(DerivedIdentitiesNamespace.class))
-            .addSupport(global(StatementDefinitionNamespace.class))
+            .addSupport(DerivedIdentitiesNamespace.BEHAVIOUR)
+            .addSupport(StatementDefinitionNamespace.BEHAVIOUR)
             .build();
 
     private static final StatementSupportBundle FULL_DECL_BUNDLE = StatementSupportBundle
@@ -286,7 +283,7 @@ public final class RFC7950Reactors {
             .addVersionSpecificSupport(VERSION_1_1, new AnydataStatementSupport())
             .addSupport(new IfFeatureStatementSupport())
             .addSupport(new UsesStatementSupport())
-            .addSupport(treeScoped(GroupingNamespace.class)) //treeScoped
+            .addSupport(GroupingNamespace.BEHAVIOUR)
             .addSupport(new ErrorMessageStatementSupport())
             .addSupport(new ErrorAppTagStatementSupport())
             .addVersionSpecificSupport(VERSION_1, new LeafListStatementRFC6020Support())
@@ -298,13 +295,13 @@ public final class RFC7950Reactors {
             .addSupport(new WhenStatementSupport())
             .addVersionSpecificSupport(VERSION_1, new AugmentStatementRFC6020Support())
             .addVersionSpecificSupport(VERSION_1_1, new AugmentStatementRFC7950Support())
-            .addSupport(treeScoped(AugmentToChoiceNamespace.class))
+            .addSupport(AugmentToChoiceNamespace.BEHAVIOUR)
             .addVersionSpecificSupport(VERSION_1, new RefineStatementRFC6020Support())
             .addVersionSpecificSupport(VERSION_1_1, new RefineStatementRFC7950Support())
             .addSupport(new FeatureStatementSupport())
             .addSupport(new PositionStatementSupport())
             .addSupport(new ValueStatementSupport())
-            .addSupport(global(StmtOrderingNamespace.class))
+            .addSupport(StmtOrderingNamespace.BEHAVIOUR)
             .build();
 
     private static final Map<ModelProcessingPhase, StatementSupportBundle> RFC7950_BUNDLES =
@@ -354,10 +351,10 @@ public final class RFC7950Reactors {
         return vanillaReactorBuilder()
                 // Semantic version support
                 .addStatementSupport(ModelProcessingPhase.SOURCE_LINKAGE, OpenConfigVersionSupport.getInstance())
-                .addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE, global(SemanticVersionNamespace.class))
-                .addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE, global(SemanticVersionModuleNamespace.class))
+                .addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE, SemanticVersionNamespace.BEHAVIOUR)
+                .addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE, SemanticVersionModuleNamespace.BEHAVIOUR)
                 .addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE,
-                    sourceLocal(ImportPrefixToSemVerSourceIdentifier.class));
+                    ImportPrefixToSemVerSourceIdentifier.BEHAVIOUR);
     }
 
     /**
index f4df8a5e2092b9b8777b6e35f7f37185d0745686..4ca6d751069ee3dfdf95c29d88158fafdc883579 100644 (file)
@@ -7,10 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ExtensionStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Extension namespace. All extension names defined in a module and its submodules share the same
@@ -19,5 +22,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
  */
 public interface ExtensionNamespace
     extends StatementNamespace<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> {
+    NamespaceBehaviour<QName, StmtContext<?, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>>,
+            @NonNull ExtensionNamespace> BEHAVIOUR = NamespaceBehaviour.global(ExtensionNamespace.class);
 
 }
index 7165ef6ff149e19dd7ef5cf478b75b27f308c68c..94c762297e3991d7ed9cbabfbd1f22a607cdb7de 100644 (file)
@@ -7,10 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.GroupingStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace.TreeScoped;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Grouping namespace. * All grouping names defined within a parent node or at the top level of the module
@@ -22,5 +25,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace.TreeSc
  */
 public interface GroupingNamespace
     extends TreeScoped<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> {
+    NamespaceBehaviour<QName, StmtContext<?, GroupingStatement, EffectiveStatement<QName, GroupingStatement>>,
+            @NonNull GroupingNamespace> BEHAVIOUR = NamespaceBehaviour.treeScoped(GroupingNamespace.class);
 
 }
index 2a990e4644472d5a2f786cedcab9aecec09f0e19..fc4e79781e6c8c453897fd203028f2628f648572 100644 (file)
@@ -7,10 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.IdentityStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Identity namespace. All identity names defined in a module and its submodules share the same identity identifier
@@ -18,5 +21,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
  */
 public interface IdentityNamespace extends
         StatementNamespace<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> {
+    NamespaceBehaviour<QName, StmtContext<?, IdentityStatement, EffectiveStatement<QName, IdentityStatement>>,
+            @NonNull IdentityNamespace> BEHAVIOUR = NamespaceBehaviour.global(IdentityNamespace.class);
 
 }
index 2fdc2837b4954d43f9717a8f9de3ff38c68a30a8..ca10a802bec456f86a37d90864709e3480b0fc35 100644 (file)
@@ -7,10 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Module namespace. All modules known to the reactor are populated to this namespace. Each module is identified
@@ -18,4 +21,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
  */
 public interface ModuleNamespace extends
         StatementNamespace<SourceIdentifier, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
+    NamespaceBehaviour<SourceIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>,
+            @NonNull ModuleNamespace> BEHAVIOUR = NamespaceBehaviour.global(ModuleNamespace.class);
 }
index 256671ebaa1e94cbefa792262918dcdfb14a487c..b0f0433f9f380edf52cab7a073a53b38b1c2be83 100644 (file)
@@ -7,15 +7,19 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * A derived namespace allowing lookup of modules based on their {@link QNameModule}.
  */
 public interface NamespaceToModule
     extends StatementNamespace<QNameModule, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
-
+    NamespaceBehaviour<QNameModule, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>,
+            @NonNull NamespaceToModule> BEHAVIOUR = NamespaceBehaviour.global(NamespaceToModule.class);
 }
index 36f8561a2838520ba84c5f303d7250983ed595e0..177e5bcabaac0b0b6ec6ff7797e89dde92552565 100644 (file)
@@ -7,9 +7,12 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Intermediate-stage namespace equivalent to ModuleNamespace except it is keyed by module names. This namespace is
@@ -17,4 +20,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
  */
 public interface PreLinkageModuleNamespace extends
         StatementNamespace<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
+    NamespaceBehaviour<String, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>,
+            @NonNull PreLinkageModuleNamespace> BEHAVIOUR = NamespaceBehaviour.global(PreLinkageModuleNamespace.class);
+
 }
index 979910ebf44c14434602dd8914f8157df2e8082a..cce756d4a6600e5a856bfbfdf6f275762f253cb4 100644 (file)
@@ -7,10 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SubmoduleStatement;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Submodule equivalent of ModuleNamespace.
@@ -18,5 +21,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 // FIXME: describe scoping of this namespace
 public interface SubmoduleNamespace
     extends StatementNamespace<SourceIdentifier, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>> {
-
+    NamespaceBehaviour<SourceIdentifier, StmtContext<?, SubmoduleStatement,
+            EffectiveStatement<String, SubmoduleStatement>>, @NonNull SubmoduleNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(SubmoduleNamespace.class);
 }
index e39dee487be8bb29cc2601ca75f4eef24d8af859..52ea1016b9dc90662a6b0c2c8e77e00eddf3b8cd 100644 (file)
@@ -7,10 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypedefStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace.TreeScoped;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Derived types namespace. All derived type names defined within a parent node or at the top level of the module
@@ -25,5 +28,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace.TreeSc
  * (e.g. RFC6020/RFC7950 for YANG 1.0/1.1).
  */
 public interface TypeNamespace extends TreeScoped<QName, TypedefStatement, TypedefEffectiveStatement> {
+    NamespaceBehaviour<QName, StmtContext<?, TypedefStatement, TypedefEffectiveStatement>, @NonNull TypeNamespace>
+        BEHAVIOUR = NamespaceBehaviour.treeScoped(TypeNamespace.class);
 
 }
index 78fd53a044814e530b700035e05b9a8082a32189..23a8abb7b2c141ffb3f266a5a2f520a8f9026fcf 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.parser.spi.meta;
 
 import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
@@ -17,5 +18,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
  */
 // FIXME: describe scoping and value
 public interface DerivedIdentitiesNamespace extends IdentifierNamespace<QName, List<StmtContext<?, ?, ?>>> {
+    NamespaceBehaviour<QName, List<StmtContext<?, ?, ?>>, @NonNull DerivedIdentitiesNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(DerivedIdentitiesNamespace.class);
 
 }
index ab0692f8e97d8b17c132158d2da67401f266660d..b3348c52506170cef918e107d1f0fe200c50a25d 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.parser.spi.meta;
 
 import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
 import org.opendaylight.yangtools.yang.model.repo.api.SemVerSourceIdentifier;
@@ -19,5 +20,8 @@ import org.opendaylight.yangtools.yang.model.repo.api.SemVerSourceIdentifier;
 @Beta
 public interface SemanticVersionModuleNamespace
     extends StatementNamespace<SemVerSourceIdentifier, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
+    NamespaceBehaviour<SemVerSourceIdentifier, StmtContext<?, ModuleStatement,
+            EffectiveStatement<String, ModuleStatement>>, @NonNull SemanticVersionModuleNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(SemanticVersionModuleNamespace.class);
 
 }
index f03eaf3476a54a9345032f626473bcd25d590141..4394b6b4954074c3e8b9bffeab1ffeb99d77793f 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.parser.spi.meta;
 
 import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.SemVer;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
@@ -16,4 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
  */
 @Beta
 public interface SemanticVersionNamespace extends IdentifierNamespace<StmtContext<?, ?, ?>, SemVer> {
+    NamespaceBehaviour<StmtContext<?, ?, ?>, SemVer, @NonNull SemanticVersionNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(SemanticVersionNamespace.class);
+
 }
index 16741f34e8616173db3c87da6a672b26f8941b42..f851c299a4b38e455410c14a3ccc181a056a8f8c 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.parser.spi.meta;
 
 import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
@@ -20,5 +21,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
  */
 @Beta
 public interface StatementDefinitionNamespace extends IdentifierNamespace<QName, StatementSupport<?, ?, ?>> {
+    NamespaceBehaviour<QName, StatementSupport<?, ?, ?>, @NonNull StatementDefinitionNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(StatementDefinitionNamespace.class);
 
 }
index b5450d9fe3bb1e5821a4f84765bb5a200d660e56..c1f630793b0ca7ce09b110d59faa62ece607b1e9 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
@@ -15,5 +17,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
  * shortHand case nodes into choice node.
  */
 public interface AugmentToChoiceNamespace extends IdentifierNamespace<StmtContext<?, ?, ?>, Boolean> {
+    NamespaceBehaviour<StmtContext<?, ?, ?>, Boolean, @NonNull AugmentToChoiceNamespace> BEHAVIOUR =
+            NamespaceBehaviour.treeScoped(AugmentToChoiceNamespace.class);
 
 }
index 3c78266aad9337f96e63ef19b9a52b56251edc35..54e756a3aaf65848e49dd2ab33850ede0de4a3bd 100644 (file)
@@ -7,12 +7,16 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ImportedNamespaceContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Namespace key class for storing belongs-to statements in YANG model storage.
  */
 public interface BelongsToModuleContext extends ImportedNamespaceContext<SourceIdentifier> {
-
+    NamespaceBehaviour<SourceIdentifier, StmtContext<?, ?, ?>, @NonNull BelongsToModuleContext> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(BelongsToModuleContext.class);
 }
index ab3f74cd9a8d4f6ea163a16fa16d3a3540e356a9..d13687e601b49693903bd0fbab2db1a3dde7976e 100644 (file)
@@ -7,7 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ImportedNamespaceContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Source-specific mapping of belongsTo prefixes to module identifiers. This mapping allows source-specific context
@@ -15,5 +18,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.ImportedNamespaceContext;
  * statement.
  */
 public interface BelongsToPrefixToModuleCtx extends ImportedNamespaceContext<String> {
-
+    NamespaceBehaviour<String, StmtContext<?, ?, ?>, @NonNull BelongsToPrefixToModuleCtx> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(BelongsToPrefixToModuleCtx.class);
 }
index 054a7b99bf6b00b40ea4d365a0ce9875f16115d0..dc65d03f3281208d4c88913f636e855a958e2285 100644 (file)
@@ -7,11 +7,14 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Source-specific mapping of prefixes to namespaces.
  */
 public interface BelongsToPrefixToModuleName extends IdentifierNamespace<String, String> {
-
+    NamespaceBehaviour<String, String, @NonNull BelongsToPrefixToModuleName> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(BelongsToPrefixToModuleName.class);
 }
index 6c074a7afcd29785dccc3531182ed7dee78cacf1..8d0d1f7d25203796f4b59e88ba7f570194901df9 100644 (file)
@@ -8,11 +8,14 @@
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
 import java.net.URI;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Pre-linkage source-specific mapping of prefixes to module namespaces.
  */
 public interface ImpPrefixToNamespace extends IdentifierNamespace<String, URI> {
-
+    NamespaceBehaviour<String, URI, @NonNull ImpPrefixToNamespace> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(ImpPrefixToNamespace.class);
 }
index b6195bde9402e725ec3f1eeffaf73bb82b3e3931..008034ed1bb9893d2a7c0f14003bfbcdce953be0 100644 (file)
@@ -7,11 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ImportedNamespaceContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Source-specific mapping of prefix strings to module context.
  */
 public interface ImportPrefixToModuleCtx extends ImportedNamespaceContext<String> {
-
+    NamespaceBehaviour<String, StmtContext<?, ?, ?>, @NonNull ImportPrefixToModuleCtx> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(ImportPrefixToModuleCtx.class);
 }
index b6fe7a5e61654c1de729b1f8087d83b342344eed..8de1f60c639cca831a97b42479a6bb80a80b09ee 100644 (file)
@@ -8,8 +8,10 @@
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
 import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.model.repo.api.SemVerSourceIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Source-specific mapping of prefixes to source identifier with specified semantic version.
@@ -17,5 +19,7 @@ import org.opendaylight.yangtools.yang.model.repo.api.SemVerSourceIdentifier;
 @Beta
 public interface ImportPrefixToSemVerSourceIdentifier
     extends IdentifierNamespace<String, SemVerSourceIdentifier> {
+    NamespaceBehaviour<String, SemVerSourceIdentifier, @NonNull ImportPrefixToSemVerSourceIdentifier> BEHAVIOUR =
+        NamespaceBehaviour.sourceLocal(ImportPrefixToSemVerSourceIdentifier.class);
 
 }
index 4c835b253b3ec7c018a1975a68cecf4a8525875f..3cabb5e719e9ff19abeea140965a331a189d134b 100644 (file)
@@ -7,9 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ImportedNamespaceContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public interface ImportedModuleContext extends ImportedNamespaceContext<SourceIdentifier> {
-
+    NamespaceBehaviour<SourceIdentifier, StmtContext<?, ?, ?>, @NonNull ImportedModuleContext> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(ImportedModuleContext.class);
 }
index fa4db8efbb6695055dc6f66e0798141dc400875e..8500decf9b56564da0d2640ad3fc491968769a01 100644 (file)
@@ -7,9 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ImportedNamespaceContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 public interface IncludedModuleContext extends ImportedNamespaceContext<SourceIdentifier> {
-
+    NamespaceBehaviour<SourceIdentifier, StmtContext<?, ?, ?>, @NonNull IncludedModuleContext> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(IncludedModuleContext.class);
 }
index 9d5cb52afc981f76b00cc0cc7d4d2effd3ac8a5b..2b5f97a0de053fbb4f84eb0d154fe70ffdad173a 100644 (file)
@@ -7,12 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Source-specific mapping of prefixes to namespaces.
  */
 public interface IncludedSubmoduleNameToModuleCtx extends IdentifierNamespace<String, StmtContext<?, ?, ?>> {
-
+    NamespaceBehaviour<String, StmtContext<?, ?, ?>, @NonNull IncludedSubmoduleNameToModuleCtx> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(IncludedSubmoduleNameToModuleCtx.class);
 }
index 4360e8e3fe1218797b9476a35f9c4b4ce9aa3b3a..c0d097f3c66773d394d0e2f48db5dcb6e0a7d00d 100644 (file)
@@ -7,13 +7,17 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Global mapping of modules to QNameModules.
  */
 public interface ModuleCtxToModuleQName extends IdentifierNamespace<StmtContext<?,?,?>, QNameModule> {
+    NamespaceBehaviour<StmtContext<?, ?, ?>, QNameModule, @NonNull ModuleCtxToModuleQName> BEHAVIOUR =
+            NamespaceBehaviour.global(ModuleCtxToModuleQName.class);
 
 }
index ebe96d36657d3c7a134d4512dbad7c0722ecc458..040379841e738a913ae98666b15f771bb043933f 100644 (file)
@@ -7,13 +7,16 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * Global mapping of modules to source identifier.
  */
 public interface ModuleCtxToSourceIdentifier extends IdentifierNamespace<StmtContext<?, ?, ?>, SourceIdentifier> {
-
+    NamespaceBehaviour<StmtContext<?, ?, ?>, SourceIdentifier, @NonNull ModuleCtxToSourceIdentifier> BEHAVIOUR =
+            NamespaceBehaviour.global(ModuleCtxToSourceIdentifier.class);
 }
index 02d2ee854aebb52c52407325952d20656f6df0bf..e1ea85abfed47df8faf864acf5033d664fcb2f1b 100644 (file)
@@ -7,12 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Source-specific mapping of prefixes to namespaces.
  */
 public interface ModuleNameToModuleQName extends IdentifierNamespace<String, QNameModule> {
-
+    NamespaceBehaviour<String, QNameModule, @NonNull ModuleNameToModuleQName> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(ModuleNameToModuleQName.class);
 }
index dd60258fb473ba5794cbd1a965f043df8f867fd5..49c0c4fab49067006f8fd220191a2591c6a6ef9b 100644 (file)
@@ -8,11 +8,14 @@
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
 import java.net.URI;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Pre-linkage global mapping of module names to namespaces.
  */
 public interface ModuleNameToNamespace extends IdentifierNamespace<String, URI> {
-
+    NamespaceBehaviour<String, URI, @NonNull ModuleNameToNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(ModuleNameToNamespace.class);
 }
index f3af7fc0830fe35760e248e22531f42ab11f3578..d55d2fad65af1869da1474c407c8d7d4790af19d 100644 (file)
@@ -7,9 +7,12 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * namespace class similar to {@link org.opendaylight.yangtools.yang.parser.spi.ModuleNamespace} for storing modules
@@ -17,5 +20,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
  */
 public interface ModuleNamespaceForBelongsTo extends
         StatementNamespace<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
-
+    NamespaceBehaviour<String, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>,
+            @NonNull ModuleNamespaceForBelongsTo> BEHAVIOUR = NamespaceBehaviour.global(
+                ModuleNamespaceForBelongsTo.class);
 }
index 7d7d9b4cc3c46bec12220b5c20cb2af6e528db70..3bce75f8cde8aa89837b36f7e026bc5e87df9775 100644 (file)
@@ -7,12 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Source-specific mapping of prefixes to namespaces.
  */
 public interface ModuleQNameToModuleName extends IdentifierNamespace<QNameModule, String> {
-
+    NamespaceBehaviour<QNameModule, String, @NonNull ModuleQNameToModuleName> BEHAVIOUR =
+            NamespaceBehaviour.global(ModuleQNameToModuleName.class);
 }
index 77caed506bc228aa73e8442b0e343bd0eb92729b..b4d16ac6eba22732e78e0d1979cf53ce9289db1c 100644 (file)
@@ -11,8 +11,10 @@ package org.opendaylight.yangtools.yang.parser.spi.source;
 import com.google.common.annotations.Beta;
 import java.util.Map;
 import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Namespace used for storing information about modules that support deviation resolution.
@@ -21,6 +23,8 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 @Beta
 public interface ModulesDeviatedByModules
         extends IdentifierNamespace<ModulesDeviatedByModules.SupportedModules, Map<QNameModule, Set<QNameModule>>> {
+    NamespaceBehaviour<SupportedModules, Map<QNameModule, Set<QNameModule>>, @NonNull ModulesDeviatedByModules>
+        BEHAVIOUR = NamespaceBehaviour.global(ModulesDeviatedByModules.class);
 
     enum SupportedModules {
         SUPPORTED_MODULES
index 30a8a420e4c12b088ec74808e5d16d9b96da5fa9..5d31772885a66b7e38ff07f12ca273cce1b80c63 100644 (file)
@@ -10,14 +10,17 @@ package org.opendaylight.yangtools.yang.parser.spi.source;
 import java.net.URISyntaxException;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Source-specific mapping of prefixes to namespaces.
  */
 public interface PrefixToModule extends IdentifierNamespace<String, QNameModule> {
-
+    NamespaceBehaviour<String, QNameModule, @NonNull PrefixToModule> BEHAVIOUR =
+            NamespaceBehaviour.global(PrefixToModule.class);
     String DEFAULT_PREFIX = "";
 
     /**
index 23067a674acbd41c6f1e38dff6299827f0df6956..53cbd845ecd011b796c1a716c7a243fbf11fa3e3 100644 (file)
@@ -10,14 +10,19 @@ package org.opendaylight.yangtools.yang.parser.spi.source;
 import java.net.URI;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Map of fully qualified statement name to statement definition.
  */
 public interface QNameToStatementDefinition extends IdentifierNamespace<QName, StatementDefinition> {
+    NamespaceBehaviour<QName, StatementDefinition, @NonNull QNameToStatementDefinition> BEHAVIOUR =
+            NamespaceBehaviour.sourceLocal(QNameToStatementDefinition.class);
+
     /**
      * Returns StatementDefinition with specified QName.
      *
@@ -25,6 +30,7 @@ public interface QNameToStatementDefinition extends IdentifierNamespace<QName, S
      *            QName of requested statement
      * @return StatementDefinition
      */
+    @Override
     @Nullable
     StatementDefinition get(@Nonnull QName identifier);
 
index 68514b89ab5baccc09d7f3d799b954322a3f0765..54cb7cb70acbbf28115007d0b124e7ad4c92a9af 100644 (file)
@@ -7,12 +7,16 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Map of statement order.
  */
-public interface StmtOrderingNamespace extends
-        IdentifierNamespace<YangStmtMapping, Integer> {
+public interface StmtOrderingNamespace extends IdentifierNamespace<YangStmtMapping, Integer> {
+    NamespaceBehaviour<YangStmtMapping, Integer, @NonNull StmtOrderingNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(StmtOrderingNamespace.class);
+
 }
\ No newline at end of file
index 95b8f954abdb90ee048959f65263392e434daeb5..1d937d17dc888a51feb4c22b14ad76dbefa6c29f 100644 (file)
@@ -9,11 +9,15 @@
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
 import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 public interface SupportedFeaturesNamespace
         extends IdentifierNamespace<SupportedFeaturesNamespace.SupportedFeatures, Set<QName>> {
+    NamespaceBehaviour<SupportedFeatures, Set<QName>, @NonNull SupportedFeaturesNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(SupportedFeaturesNamespace.class);
 
     enum SupportedFeatures {
         SUPPORTED_FEATURES
index e2f5b0fcf373aedb38832ebd5bb5584900a14eea..a18138807b9911fecf1fc9652cc00b27fddd8b58 100644 (file)
@@ -9,7 +9,9 @@
 package org.opendaylight.yangtools.yang.parser.spi.validation;
 
 import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
 /**
  * Namespace used for validating whether a node is of some type, e.g. usable target for some operation or has other
@@ -17,6 +19,8 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
  */
 public interface ValidationBundlesNamespace extends
         IdentifierNamespace<ValidationBundlesNamespace.ValidationBundleType, Collection<?>> {
+    NamespaceBehaviour<ValidationBundleType, Collection<?>, @NonNull ValidationBundlesNamespace> BEHAVIOUR =
+            NamespaceBehaviour.global(ValidationBundlesNamespace.class);
 
     enum ValidationBundleType {
         /**