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;
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);
@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);
}
@Override
- public <Y extends DeclaredStatement<QName>, Z extends EffectiveStatement<QName, Y>>
+ public <Y extends DeclaredStatement<QName>, Z extends SchemaTreeEffectiveStatement<Y>>
StmtContext<QName, Y, Z> requestSchemaTreeChild(final QName qname) {
if (substatements instanceof List) {
// We have performed materialization, hence we have triggered creation of all our schema tree child
@SuppressWarnings("unchecked")
final Mutable<QName, Y, Z> ret = (Mutable<QName, Y, Z>) copySubstatement((Mutable<?, ?, ?>) template)
- .orElseThrow(() -> new InferenceException(sourceReference(),
- "Failed to materialize child %s template %s", qname, template));
+ .orElseThrow(
+ () -> new InferenceException(this, "Failed to materialize child %s template %s", qname, template));
ensureCompletedPhase(ret);
addMaterialized(template, ret);
verify(substatements != SWEPT_SUBSTATEMENTS, "Attempted to access substatements of %s", this);
}
+ @Override
+ void markNoParentRef() {
+ final Object local = substatements;
+ if (local != null) {
+ markNoParentRef(castEffective(local));
+ }
+ }
+
@Override
int sweepSubstatements() {
final Object local = substatements;
}
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);
}
}
@Override
- public boolean effectiveConfig() {
- return isConfiguration(parent);
+ public EffectiveConfig effectiveConfig() {
+ return effectiveConfig(parent);
}
@Override