/** * Create a new {@link DataTreeSnapshotCursor} at specified path. May fail * if specified path does not exist. * * @param path Path at which the cursor is to be anchored * @return A new cursor, or empty if the path does not exist. * @throws IllegalStateException if there is another cursor currently open. */ default Optional<? extends DataTreeSnapshotCursor> openCursor(@Nonnull final YangInstanceIdentifier path) { return Optional.ofNullable(createCursor(path)); }
/** * Create a new {@link DataTreeSnapshotCursor} at the root of the modification. * * @return A new cursor * @throws IllegalStateException if there is another cursor currently open. */ default DataTreeSnapshotCursor openCursor() { return openCursor(YangInstanceIdentifier.EMPTY).get(); }
DataTreeModificationCursorAdaptor cursor() { if (cursor == null) { if (modification == null) { modification = snapshot.newModification(); } // FIXME: Should there be non-root path? DataTreeModificationCursor dataTreeCursor = modification.createCursor(YangInstanceIdentifier.EMPTY); cursor = DataTreeModificationCursorAdaptor.of(dataTreeCursor); } return cursor; }
/** * Create a new {@link DataTreeSnapshotCursor} at the root of the modification. * * @return A new cursor * @throws IllegalStateException if there is another cursor currently open. */ default DataTreeSnapshotCursor openCursor() { return openCursor(YangInstanceIdentifier.EMPTY).get(); }
/** * Create a new {@link DataTreeSnapshotCursor} at specified path. May fail * if specified path does not exist. * * @param path Path at which the cursor is to be anchored * @return A new cursor, or empty if the path does not exist. * @throws IllegalStateException if there is another cursor currently open. */ default Optional<? extends DataTreeSnapshotCursor> openCursor(@Nonnull final YangInstanceIdentifier path) { return Optional.ofNullable(createCursor(path)); }