Improve StatementContextBase.stream{Declared,Effective}
[yangtools.git] / parser / yang-parser-reactor / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / reactor / ReactorStmtCtx.java
index 1020b649d0138a820b917addf57acb70da595eea..a00b5446e56db4d2fbfd566267cc50fec0fd18af 100644 (file)
@@ -34,6 +34,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.RefineStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
 import org.opendaylight.yangtools.yang.model.api.stmt.UsesStatement;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.ParserNamespaces;
 import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStatementState;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
@@ -48,7 +49,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SupportedFeaturesNamespace;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -321,25 +321,22 @@ abstract class ReactorStmtCtx<A, D extends DeclaredStatement<A>, E extends Effec
     //
 
     @Override
-    public final <K, V, T extends K, N extends ParserNamespace<K, V>> V namespaceItem(final Class<@NonNull N> type,
-            final T key) {
+    public final <K, V, T extends K> V namespaceItem(final ParserNamespace<K, V> type, final T key) {
         return getBehaviourRegistry().getNamespaceBehaviour(type).getFrom(this, key);
     }
 
     @Override
-    public final <K, V, N extends ParserNamespace<K, V>> Map<K, V> namespace(final Class<@NonNull N> type) {
+    public final <K, V> Map<K, V> namespace(final ParserNamespace<K, V> type) {
         return getNamespace(type);
     }
 
     @Override
-    public final <K, V, N extends ParserNamespace<K, V>>
-            Map<K, V> localNamespacePortion(final Class<@NonNull N> type) {
+    public final <K, V> Map<K, V> localNamespacePortion(final ParserNamespace<K, V> type) {
         return getLocalNamespace(type);
     }
 
     @Override
-    protected <K, V, N extends ParserNamespace<K, V>> void onNamespaceElementAdded(final Class<N> type, final K key,
-            final V value) {
+    protected <K, V> void onNamespaceElementAdded(final ParserNamespace<K, V> type, final K key, final V value) {
         // definition().onNamespaceElementAdded(this, type, key, value);
     }
 
@@ -405,8 +402,8 @@ abstract class ReactorStmtCtx<A, D extends DeclaredStatement<A>, E extends Effec
      * @return Built effective stateue
      */
     abstract @NonNull E createInferredEffective(@NonNull StatementFactory<A, D, E> factory,
-        @NonNull InferredStatementContext<A, D, E> ctx, Stream<? extends StmtContext<?, ?, ?>> declared,
-        Stream<? extends StmtContext<?, ?, ?>> effective);
+        @NonNull InferredStatementContext<A, D, E> ctx, Stream<? extends ReactorStmtCtx<?, ?, ?>> declared,
+        Stream<? extends ReactorStmtCtx<?, ?, ?>> effective);
 
     /**
      * Attach an effective copy of this statement. This essentially acts as a map, where we make a few assumptions:
@@ -495,7 +492,8 @@ abstract class ReactorStmtCtx<A, D extends DeclaredStatement<A>, E extends Effec
          */
         if (isParentSupportedByFeatures()) {
             // If the set of supported features has not been provided, all features are supported by default.
-            final Set<QName> supportedFeatures = getFromNamespace(SupportedFeaturesNamespace.class, Empty.value());
+            final Set<QName> supportedFeatures = getFromNamespace(ParserNamespaces.SUPPORTED_FEATURES,
+                Empty.value());
             if (supportedFeatures == null || StmtContextUtils.checkFeatureSupport(this, supportedFeatures)) {
                 flags |= SET_SUPPORTED_BY_FEATURES;
                 return true;