Hide RootStatementContext
[yangtools.git] / parser / yang-parser-reactor / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / reactor / RootStatementContext.java
index d1ca478b9f7b95b5556052aa83f894b4e5ea73bb..6a9be59ba3d8ea5ca703f56cf9228764076aed30 100644 (file)
@@ -28,7 +28,6 @@ import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.ParserNamespaces;
-import org.opendaylight.yangtools.yang.parser.spi.SchemaTreeNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
 import org.opendaylight.yangtools.yang.parser.spi.meta.MutableStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode;
@@ -36,7 +35,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.Regist
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.RootStmtContext;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceParserNamespaces;
 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,15 +43,15 @@ import org.slf4j.LoggerFactory;
  * Root statement class for a YANG source. All statements defined in that YANG source are mapped underneath an instance
  * of this class, hence recursive lookups from them cross this class.
  */
-public final class RootStatementContext<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
+final class RootStatementContext<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
         extends AbstractResumedStatement<A, D, E> implements RootStmtContext.Mutable<A, D, E> {
-    public static final YangVersion DEFAULT_VERSION = YangVersion.VERSION_1;
+    static final YangVersion DEFAULT_VERSION = YangVersion.VERSION_1;
 
     private static final Logger LOG = LoggerFactory.getLogger(RootStatementContext.class);
     // These namespaces are well-known and not needed after the root is cleaned up
     private static final Map<ParserNamespace<?, ?>, SweptNamespace> SWEPT_NAMESPACES = ImmutableMap.of(
         ParserNamespaces.GROUPING, new SweptNamespace(ParserNamespaces.GROUPING),
-        SchemaTreeNamespace.instance(), new SweptNamespace(SchemaTreeNamespace.instance()),
+        ParserNamespaces.schemaTree(), new SweptNamespace(ParserNamespaces.schemaTree()),
         ParserNamespaces.TYPE, new SweptNamespace(ParserNamespaces.TYPE));
 
     private final @NonNull SourceSpecificContext sourceContext;
@@ -121,8 +119,8 @@ public final class RootStatementContext<A, D extends DeclaredStatement<A>, E ext
     }
 
     @Override
-    public <K, V, N extends ParserNamespace<K, V>> V putToLocalStorage(final N type, final K key, final V value) {
-        if (SourceParserNamespaces.INCLUDED_MODULE.equals(type)) {
+    public <K, V> V putToLocalStorage(final ParserNamespace<K, V> type, final K key, final V value) {
+        if (ParserNamespaces.INCLUDED_MODULE.equals(type)) {
             if (includedContexts.isEmpty()) {
                 includedContexts = new ArrayList<>(1);
             }
@@ -133,7 +131,7 @@ public final class RootStatementContext<A, D extends DeclaredStatement<A>, E ext
     }
 
     @Override
-    public <K, V, N extends ParserNamespace<K, V>> V getFromLocalStorage(final N type, final K key) {
+    public <K, V> V getFromLocalStorage(final ParserNamespace<K, V> type, final K key) {
         return getFromLocalStorage(type, key, new HashSet<>());
     }
 
@@ -141,8 +139,8 @@ public final class RootStatementContext<A, D extends DeclaredStatement<A>, E ext
      * We need to track already checked RootStatementContexts due to possible
      * circular chains of includes between submodules
      */
-    private <K, V, N extends ParserNamespace<K, V>> @Nullable V getFromLocalStorage(final N type,
-            final K key, final HashSet<RootStatementContext<?, ?, ?>> alreadyChecked) {
+    private <K, V> @Nullable V getFromLocalStorage(final ParserNamespace<K, V> type, final K key,
+            final HashSet<RootStatementContext<?, ?, ?>> alreadyChecked) {
         final V potentialLocal = super.getFromLocalStorage(type, key);
         if (potentialLocal != null) {
             return potentialLocal;
@@ -162,7 +160,7 @@ public final class RootStatementContext<A, D extends DeclaredStatement<A>, E ext
     }
 
     @Override
-    public <K, V, N extends ParserNamespace<K, V>> Map<K, V> getAllFromLocalStorage(final N type) {
+    public <K, V> Map<K, V> getAllFromLocalStorage(final ParserNamespace<K, V> type) {
         return getAllFromLocalStorage(type, new HashSet<>());
     }
 
@@ -170,7 +168,7 @@ public final class RootStatementContext<A, D extends DeclaredStatement<A>, E ext
      * We need to track already checked RootStatementContexts due to possible
      * circular chains of includes between submodules
      */
-    private <K, V, N extends ParserNamespace<K, V>> @Nullable Map<K, V> getAllFromLocalStorage(final N type,
+    private <K, V> @Nullable Map<K, V> getAllFromLocalStorage(final ParserNamespace<K, V> type,
             final HashSet<RootStatementContext<?, ?, ?>> alreadyChecked) {
         final Map<K, V> potentialLocal = super.getAllFromLocalStorage(type);
         if (potentialLocal != null) {