private boolean sealed = false;
public NormalizedNodePruner(final YangInstanceIdentifier nodePath, final SchemaContext schemaContext) {
- nodePathSchemaNode = findSchemaNodeForNodePath(nodePath, schemaContext);
+ nodePathSchemaNode = DataSchemaContextTree.from(schemaContext).findChild(nodePath).orElse(null);
}
@SuppressWarnings("unchecked")
stack.push(wrapper);
return wrapper;
}
-
- private static DataSchemaContextNode<?> findSchemaNodeForNodePath(final YangInstanceIdentifier nodePath,
- final SchemaContext schemaContext) {
- DataSchemaContextNode<?> schemaNode = DataSchemaContextTree.from(schemaContext).getRoot();
- for (PathArgument arg : nodePath.getPathArguments()) {
- schemaNode = schemaNode.getChild(arg);
- if (schemaNode == null) {
- break;
- }
- }
-
- return schemaNode;
- }
}