}
@Override
- Optional<? extends TreeNode> apply(final ModifiedNode modification, final Optional<? extends TreeNode> storeMeta,
+ Optional<? extends TreeNode> apply(final ModifiedNode modification, final TreeNode currentMeta,
final Version version) {
- return AutomaticLifecycleMixin.apply(super::apply, this::applyWrite, emptyNode, modification, storeMeta,
+ return AutomaticLifecycleMixin.apply(super::apply, this::applyWrite, emptyNode, modification, currentMeta,
version);
}
@Override
protected TreeNode applyWrite(final ModifiedNode modification, final NormalizedNode newValue,
- final Optional<? extends TreeNode> currentMeta, final Version version) {
+ final TreeNode currentMeta, final Version version) {
final var newValueMeta = TreeNode.of(newValue, version);
if (modification.isEmpty()) {
return newValueMeta;
@SuppressWarnings({ "rawtypes", "unchecked" })
private TreeNode mutateChildren(final MutableTreeNode meta, final NormalizedNodeContainerBuilder data,
final Version nodeVersion, final Iterable<ModifiedNode> modifications) {
+ for (var mod : modifications) {
+ final var id = mod.getIdentifier();
+ final var cm = meta.childByArg(id);
- for (final ModifiedNode mod : modifications) {
- final PathArgument id = mod.getIdentifier();
- final Optional<? extends TreeNode> cm = meta.findChildByArg(id);
-
- final Optional<? extends TreeNode> result = resolveChildOperation(id).apply(mod, cm, nodeVersion);
+ final var result = resolveChildOperation(id).apply(mod, cm, nodeVersion);
if (result.isPresent()) {
final TreeNode tn = result.orElseThrow();
meta.putChild(tn);
@Override
protected void checkTouchApplicable(final ModificationPath path, final NodeModification modification,
- final Optional<? extends TreeNode> current, final Version version) throws IncorrectDataStructureException {
+ final TreeNode currentMeta, final Version version) throws IncorrectDataStructureException {
throw new IncorrectDataStructureException(path.toInstanceIdentifier(), "Subtree modification is not allowed.");
}