Separate out StatementSupport.applyCopyPolicy()
[yangtools.git] / yang / yang-parser-reactor / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / reactor / InferredStatementContext.java
index 26ab73032b04a911bbbdcc9efa9a1ca73899c9b0..fb691e3c319ed460947c4be3b48cc7d6528fdcbd 100644 (file)
@@ -37,7 +37,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.OnDemandSchemaTreeStorageNode;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextDefaults;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
 import org.slf4j.Logger;
@@ -191,7 +190,7 @@ final class InferredStatementContext<A, D extends DeclaredStatement<A>, E extend
     public <X, Z extends EffectiveStatement<X, ?>> @NonNull Optional<X> findSubstatementArgument(
             final @NonNull Class<Z> type) {
         if (substatements instanceof List) {
-            return StmtContextDefaults.findSubstatementArgument(this, type);
+            return super.findSubstatementArgument(type);
         }
 
         final Optional<X> templateArg = prototype.findSubstatementArgument(type);
@@ -207,7 +206,7 @@ final class InferredStatementContext<A, D extends DeclaredStatement<A>, E extend
 
     @Override
     public boolean hasSubstatement(final @NonNull Class<? extends EffectiveStatement<?, ?>> type) {
-        return substatements instanceof List ? StmtContextDefaults.hasSubstatement(prototype, type)
+        return substatements instanceof List ? super.hasSubstatement(type)
             // We do not allow deletion of partially-materialized statements, hence this is accurate
             : prototype.hasSubstatement(type);
     }
@@ -377,6 +376,10 @@ final class InferredStatementContext<A, D extends DeclaredStatement<A>, E extend
     }
 
     private Optional<? extends Mutable<?, ?, ?>> copySubstatement(final Mutable<?, ?, ?> substatement) {
+        // FIXME: YANGTOOLS-1195: this is not exactly what we want to do here, because we are deling with two different
+        //                        requests: copy for inference purposes (this method), while we also copy for purposes
+        //                        of buildEffective() -- in which case we want to probably invoke asEffectiveChildOf()
+        //                        or similar
         return substatement.copyAsChildOf(this, childCopyType, targetModule);
     }
 
@@ -458,8 +461,8 @@ final class InferredStatementContext<A, D extends DeclaredStatement<A>, E extend
     }
 
     @Override
-    public boolean effectiveConfig() {
-        return isConfiguration(parent);
+    public EffectiveConfig effectiveConfig() {
+        return effectiveConfig(parent);
     }
 
     @Override