import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingAugmentationCodecTreeNode;
import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.ExactDataObjectStep;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
private LazyAugmentationModification(final BindingAugmentationCodecTreeNode<A> codec,
final DataTreeCandidateNode parent, final ImmutableList<DataTreeCandidateNode> domChildNodes) {
- super(parent, codec, codec.deserializePathArgument(null));
+ super(parent, codec, (ExactDataObjectStep<A>) codec.deserializePathArgument(null));
this.domChildNodes = requireNonNull(domChildNodes);
}
final Collection<DataTreeCandidateNode> children) {
// Filter out any unmodified children first
final var domChildren = children.stream()
- .filter(childMod -> childMod.getModificationType() != UNMODIFIED)
+ .filter(childMod -> childMod.modificationType() != UNMODIFIED)
.collect(ImmutableList.toImmutableList());
// Only return a modification if there is something left
return domChildren.isEmpty() ? null : new LazyAugmentationModification<>(codec, parent, domChildren);
final BindingAugmentationCodecTreeNode<A> codec, final DataTreeCandidateNode parent) {
final var builder = ImmutableList.<DataTreeCandidateNode>builder();
for (var pathArg : codec.childPathArguments()) {
- parent.getModifiedChild(pathArg).ifPresent(builder::add);
+ final var child = parent.modifiedChild(pathArg);
+ if (child != null) {
+ builder.add(child);
+ }
}
final var domChildren = builder.build();
return domChildren.isEmpty() ? null : new LazyAugmentationModification<>(codec, parent, domChildren);
@Override
org.opendaylight.yangtools.yang.data.tree.api.ModificationType domModificationType() {
- final var before = getDataBefore();
- final var after = getDataAfter();
+ final var before = dataBefore();
+ final var after = dataAfter();
if (before == null) {
return after == null ? org.opendaylight.yangtools.yang.data.tree.api.ModificationType.UNMODIFIED
: org.opendaylight.yangtools.yang.data.tree.api.ModificationType.APPEARED;
DataTreeCandidateNode firstModifiedChild(final PathArgument arg) {
// Not entirely efficient linear search, but otherwise we'd have to index, which is even slower
return domChildNodes.stream()
- .filter(child -> arg.equals(child.getIdentifier()))
+ .filter(child -> arg.equals(child.name()))
.findFirst()
.orElse(null);
}
@Override
ToStringHelper addToStringAttributes(final ToStringHelper helper) {
return super.addToStringAttributes(helper)
- .add("domType", domData.getModificationType())
+ .add("domType", domData.modificationType())
.add("domChildren", domChildNodes);
}
}