Update CursorAwareDataTree{Modification,Snapshot} API
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / tree / DataTreeCandidates.java
index 629c782b2bdf5d1b850f3a5085b04f760808675f..b933ce1e3e248d5e213c0f2cd891ca89024ba1ef 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.data.api.schema.tree;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import java.util.Iterator;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -81,11 +82,11 @@ public final class DataTreeCandidates {
             final DataTreeCandidate candidate) {
         final YangInstanceIdentifier candidatePath = candidate.getRootPath();
         if (candidatePath.isEmpty()) {
-            try (DataTreeModificationCursor cursor = modification.createCursor(candidatePath)) {
+            try (DataTreeModificationCursor cursor = modification.openCursor()) {
                 DataTreeCandidateNodes.applyRootToCursor(cursor, candidate.getRootNode());
             }
         } else {
-            try (DataTreeModificationCursor cursor = modification.createCursor(candidatePath.getParent())) {
+            try (DataTreeModificationCursor cursor = modification.openCursor(candidatePath.getParent()).get()) {
                 DataTreeCandidateNodes.applyRootedNodeToCursor(cursor, candidatePath, candidate.getRootNode());
             }
         }
@@ -98,8 +99,8 @@ public final class DataTreeCandidates {
 
         NodeIterator(@Nullable final NodeIterator parent, @Nonnull final YangInstanceIdentifier path,
                 @Nonnull final Iterator<DataTreeCandidateNode> iterator) {
-            this.iterator = Preconditions.checkNotNull(iterator);
-            this.path = Preconditions.checkNotNull(path);
+            this.iterator = requireNonNull(iterator);
+            this.path = requireNonNull(path);
             this.parent = parent;
         }