import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import java.util.stream.Stream;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.common.Empty;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase.ExecutionOrder;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.Registry;
import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StatementFactory;
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;
public abstract RootStatementContext<?, ?, ?> getRoot();
@Override
- public abstract Collection<? extends StatementContextBase<?, ?, ?>> mutableDeclaredSubstatements();
+ public abstract Collection<? extends @NonNull StatementContextBase<?, ?, ?>> mutableDeclaredSubstatements();
@Override
- public final @NonNull Registry getBehaviourRegistry() {
+ public final Registry getBehaviourRegistry() {
return getRoot().getBehaviourRegistryImpl();
}
return QName.create(StmtContextUtils.getRootModuleQName(root), root.getRawArgument());
}
- @Override
- @Deprecated(since = "7.0.9", forRemoval = true)
- public final EffectiveStatement<?, ?> original() {
- return getOriginalCtx().map(StmtContext::buildEffective).orElse(null);
- }
-
//
// In the next two methods we are looking for an effective statement. If we already have an effective instance,
// defer to it's implementation of the equivalent search. Otherwise we search our substatement contexts.
QNameModule targetModule);
@Override
- public final ReactorStmtCtx<A, D, E> replicaAsChildOf(final Mutable<?, ?, ?> parent) {
+ public final ReplicaStatementContext<A, D, E> replicaAsChildOf(final Mutable<?, ?, ?> parent) {
checkArgument(parent instanceof StatementContextBase, "Unsupported parent %s", parent);
- return replicaAsChildOf((StatementContextBase<?, ?, ?>) parent);
+ final var ret = replicaAsChildOf((StatementContextBase<?, ?, ?>) parent);
+ definition().onStatementAdded(ret);
+ return ret;
}
abstract @NonNull ReplicaStatementContext<A, D, E> replicaAsChildOf(@NonNull StatementContextBase<?, ?, ?> parent);
abstract @NonNull E createEffective();
+ /**
+ * Routing of the request to build an effective statement from {@link InferredStatementContext} towards the original
+ * definition site. This is needed to pick the correct instantiation method: for declared statements we will
+ * eventually land in {@link AbstractResumedStatement}, for underclared statements that will be
+ * {@link UndeclaredStmtCtx}.
+ *
+ * @param factory Statement factory
+ * @param ctx Inferred statement context, i.e. where the effective statement is instantiated
+ * @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);
+
/**
* Attach an effective copy of this statement. This essentially acts as a map, where we make a few assumptions:
* <ul>