[YANGTOOLS-901] Use SchemaContext to guide NormalizedNode traversal of choices Created: 10/Sep/18 Updated: 21/Dec/23 |
|
| Status: | Confirmed |
| Project: | yangtools |
| Component/s: | data-impl |
| Affects Version/s: | None |
| Fix Version/s: | 14.0.0 |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
LeafRefValidation currently includes the following ugly piece: private void processChildNode(final Set<Object> values, final DataContainerNode<?> parent, final PathArgument arg, final List<QNamePredicate> nodePredicates, final Deque<QNameWithPredicate> path, final YangInstanceIdentifier current) { final Optional<DataContainerChild<?, ?>> child = parent.getChild(arg); if (!child.isPresent()) { for (final DataContainerChild<?, ?> mixin : parent.getValue()) { if (mixin instanceof AugmentationNode || mixin instanceof ChoiceNode) { addValues(values, mixin, nodePredicates, path, current); } } } else { addNextValues(values, child.get(), nodePredicates, path, current); } } which is fishing through {Augmentation,Choice}Nodes – which is inefficient. Since we have a SchemaContext near, we should be able to capture the guidance to cross ChoiceNodes directly, i.e. by having a QName->List<PathArgument> lookup. One way of achieving this would be to modify QNameWithPredicate to actually be a PathArgument and have LeafRefPath follow the YangInstanceIdentifier structure. |