X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-reactor%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fparser%2Fstmt%2Freactor%2FStatementContextBase.java;h=e47deaa82d0f87f5ad7702edf952a61da61b4b60;hb=541fde521d0b4e01e1023be8612d0fcff81a67bc;hp=3674a94dc13993c7cc40e9b9d766142629e192ba;hpb=c6e3f104f035b0d7aee05fdc75d11e1a2de50f3c;p=yangtools.git
diff --git a/yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java b/yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java
index 3674a94dc1..e47deaa82d 100644
--- a/yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java
+++ b/yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java
@@ -748,11 +748,17 @@ public abstract class StatementContextBase, E
addContextToNamespace(namespace, key, stmt);
}
+ @Override
+ public Optional extends Mutable, ?, ?>> copyAsChildOf(final Mutable, ?, ?> parent, final CopyType type,
+ final QNameModule targetModule) {
+ checkEffectiveModelCompleted(this);
+ return definition.support().copyAsChildOf(this, parent, type, targetModule);
+ }
+
@Override
public final Mutable, ?, ?> childCopyOf(final StmtContext, ?, ?> stmt, final CopyType type,
final QNameModule targetModule) {
- checkState(stmt.getCompletedPhase() == ModelProcessingPhase.EFFECTIVE_MODEL,
- "Attempted to copy statement %s which has completed phase %s", stmt, stmt.getCompletedPhase());
+ checkEffectiveModelCompleted(stmt);
checkArgument(stmt instanceof StatementContextBase, "Unsupported statement %s", stmt);
return childCopyOf((StatementContextBase, ?, ?>) stmt, type, targetModule);
}
@@ -794,6 +800,12 @@ public abstract class StatementContextBase, E
return result;
}
+ private static void checkEffectiveModelCompleted(final StmtContext, ?, ?> stmt) {
+ final ModelProcessingPhase phase = stmt.getCompletedPhase();
+ checkState(phase == ModelProcessingPhase.EFFECTIVE_MODEL,
+ "Attempted to copy statement %s which has completed phase %s", stmt, phase);
+ }
+
@Beta
public final boolean hasImplicitParentSupport() {
return definition.getFactory() instanceof ImplicitParentAwareStatementSupport;
@@ -879,7 +891,7 @@ public abstract class StatementContextBase, E
if (fl != 0) {
return fl == SET_IGNORE_CONFIG;
}
- if (definition.isIgnoringConfig() || parent.isIgnoringConfig()) {
+ if (definition.support().isIgnoringConfig() || parent.isIgnoringConfig()) {
flags |= SET_IGNORE_CONFIG;
return true;
}
@@ -900,7 +912,7 @@ public abstract class StatementContextBase, E
if (fl != 0) {
return fl == SET_IGNORE_IF_FEATURE;
}
- if (definition.isIgnoringIfFeatures() || parent.isIgnoringIfFeatures()) {
+ if (definition.support().isIgnoringIfFeatures() || parent.isIgnoringIfFeatures()) {
flags |= SET_IGNORE_IF_FEATURE;
return true;
}