@Deprecated
public static @NonNull NormalizedNodeStreamWriterStack of(final EffectiveModelContext context,
final SchemaPath path) {
- return new NormalizedNodeStreamWriterStack(SchemaInferenceStack.ofInstantiatedPath(context, path));
+ return new NormalizedNodeStreamWriterStack(SchemaInferenceStack.ofSchemaPath(context, path));
}
/**
public SchemaNode startContainerNode(final NodeIdentifier name) {
LOG.debug("Enter container {}", name);
- final SchemaNode schema = enterDataTree(name);
- checkArgument(schema instanceof ContainerLike || schema instanceof NotificationDefinition,
- "Node %s is not a container nor a notification", schema);
+
+ final SchemaNode schema;
+ if (schemaStack.isEmpty() && root instanceof NotificationDefinition) {
+ // Special case for stacks initialized at notification. We pretend the first container is contained within
+ // itself.
+ // FIXME: 8.0.0: factor this special case out to something more reasonable, like being initialized at the
+ // Notification's parent and knowing to enterSchemaTree() instead of enterDataTree().
+ schema = (NotificationDefinition) root;
+ } else {
+ schema = enterDataTree(name);
+ checkArgument(schema instanceof ContainerLike, "Node %s is not a container", schema);
+ }
+
schemaStack.push(schema);
return schema;
}
checkArgument(parent instanceof DataNodeContainer, "Augmentation allowed only in DataNodeContainer", parent);
final AugmentationSchemaNode schema = findSchemaForAugment((AugmentationTarget) parent,
identifier.getPossibleChildNames());
- final AugmentationSchemaNode resolvedSchema = EffectiveAugmentationSchema.create(schema,
+ final AugmentationSchemaNode resolvedSchema = new EffectiveAugmentationSchema(schema,
(DataNodeContainer) parent);
schemaStack.push(resolvedSchema);
return resolvedSchema;