- @SuppressWarnings({"unchecked", "rawtypes"})
- static <T extends DataObject> DataTreeModification<T> create(final BindingToNormalizedNodeCodec codec,
- final DOMDataTreeCandidate candidate) {
- final Entry<InstanceIdentifier<?>, BindingCodecTreeNode<?>> codecCtx =
- codec.getSubtreeCodec(candidate.getRootPath().getRootIdentifier());
- final DataTreeIdentifier<?> path =
- DataTreeIdentifier.create(candidate.getRootPath().getDatastoreType(), codecCtx.getKey());
- final DataObjectModification<?> modification =
- LazyDataObjectModification.create(codecCtx.getValue(), candidate.getRootNode());
- return new LazyDataTreeModification(path, modification);
+ static <T extends DataObject> @Nullable DataTreeModification<T> from(final CurrentAdapterSerializer serializer,
+ final DOMDataTreeCandidate candidate, final @Nullable Class<T> augment) {
+ final var domRootPath = candidate.getRootPath();
+ @SuppressWarnings("unchecked")
+ final var bindingPath = (InstanceIdentifier<T>) createBindingPath(serializer, domRootPath.path(), augment);
+ final var codec = serializer.getSubtreeCodec(bindingPath);
+ @SuppressWarnings("unchecked")
+ final var modification = (DataObjectModification<T>) LazyDataObjectModification.from(codec,
+ candidate.getRootNode());
+ return modification == null ? null
+ : new LazyDataTreeModification<>(DataTreeIdentifier.of(domRootPath.datastore(), bindingPath), modification);