X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-data-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fdata%2Fimpl%2Fschema%2Ftree%2FAbstractModifiedNodeBasedCandidateNode.java;h=aa1ae48ceed8183951807beb85c1459f0eb757a1;hb=f6eae2a11c570c1097eb9202debc7e36ce72ef6d;hp=92586972e9a132aa4f5617874605a5d0de42d330;hpb=d2269a6fc5ceda91c54446a8458eceb78ca659b9;p=yangtools.git diff --git a/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/AbstractModifiedNodeBasedCandidateNode.java b/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/AbstractModifiedNodeBasedCandidateNode.java index 92586972e9..aa1ae48cee 100644 --- a/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/AbstractModifiedNodeBasedCandidateNode.java +++ b/yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/AbstractModifiedNodeBasedCandidateNode.java @@ -6,7 +6,6 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.yangtools.yang.data.impl.schema.tree; -import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.base.Verify; @@ -23,20 +22,12 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType; import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode; abstract class AbstractModifiedNodeBasedCandidateNode implements DataTreeCandidateNode { - - private static final Function, DataTreeCandidateNode> TO_UNMODIFIED_NODE = new Function, DataTreeCandidateNode>() { - @Override - public DataTreeCandidateNode apply(final NormalizedNode input) { - return AbstractRecursiveCandidateNode.unmodifiedNode(input); - } - }; - private final ModifiedNode mod; private final TreeNode newMeta; private final TreeNode oldMeta; - protected AbstractModifiedNodeBasedCandidateNode(final ModifiedNode mod, - final TreeNode oldMeta, final TreeNode newMeta) { + protected AbstractModifiedNodeBasedCandidateNode(final ModifiedNode mod, final TreeNode oldMeta, + final TreeNode newMeta) { this.newMeta = newMeta; this.oldMeta = oldMeta; this.mod = Preconditions.checkNotNull(mod); @@ -89,17 +80,13 @@ abstract class AbstractModifiedNodeBasedCandidateNode implements DataTreeCandida case APPEARED: case DISAPPEARED: case SUBTREE_MODIFIED: - return Collections2.transform(mod.getChildren(), new Function() { - @Override - public DataTreeCandidateNode apply(final ModifiedNode input) { - return childNode(input); - } - }); + return Collections2.transform(mod.getChildren(), this::childNode); case UNMODIFIED: // Unmodified node, but we still need to resolve potential children. canHaveChildren returns // false if both arguments are null. if (canHaveChildren(oldMeta, newMeta)) { - return Collections2.transform(getContainer(newMeta != null ? newMeta : oldMeta).getValue(), TO_UNMODIFIED_NODE); + return Collections2.transform(getContainer(newMeta != null ? newMeta : oldMeta).getValue(), + AbstractRecursiveCandidateNode::unmodifiedNode); } else { return Collections.emptyList(); } @@ -158,7 +145,7 @@ abstract class AbstractModifiedNodeBasedCandidateNode implements DataTreeCandida if (canHaveChildren(oldMeta, newMeta)) { final Optional> maybeChild = getContainer(newMeta != null ? newMeta : oldMeta).getChild(identifier); if (maybeChild.isPresent()) { - return TO_UNMODIFIED_NODE.apply(maybeChild.get()); + return AbstractRecursiveCandidateNode.unmodifiedNode(maybeChild.get()); } else { return null; }