2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.dom.api;
10 import com.google.common.annotations.Beta;
11 import javax.annotation.Nonnull;
12 import javax.annotation.concurrent.NotThreadSafe;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
17 * A cursor holding a logical position within a conceptual data tree. It allows operations relative
18 * to that position, as well as moving the position up or down the tree.
22 public interface DOMDataTreeCursor extends AutoCloseable {
24 * Move the cursor to the specified child of the current position.
26 * @param child Child identifier
27 * @throws IllegalArgumentException when specified identifier does not identify a valid child,
28 * or if that child is not an instance of {@link NormalizedNodeContainer}.
30 void enter(@Nonnull PathArgument child);
33 * Move the cursor to the specified child of the current position. This is the equivalent of
34 * multiple invocations of {@link #enter(PathArgument)}, except the operation is performed all
37 * @param path Nested child identifier
38 * @throws IllegalArgumentException when specified path does not identify a valid child, or if
39 * that child is not an instance of {@link NormalizedNodeContainer}.
41 void enter(@Nonnull PathArgument... path);
44 * Move the cursor to the specified child of the current position. This is equivalent to
45 * {@link #enter(PathArgument...)}, except it takes an {@link Iterable} argument.
47 * @param path Nested child identifier
48 * @throws IllegalArgumentException when specified path does not identify a valid child, or if
49 * that child is not an instance of {@link NormalizedNodeContainer}.
51 void enter(@Nonnull Iterable<PathArgument> path);
54 * Move the cursor up to the parent of current position. This is equivalent of invoking
55 * <code>exit(1)</code>.
57 * @throws IllegalStateException when exiting would violate containment, typically by attempting
58 * to exit more levels than previously entered.
63 * Move the cursor up by specified amounts of steps from the current position. This is
64 * equivalent of invoking {@link #exit()} multiple times, except the operation is performed
67 * @param depth number of steps to exit
68 * @throws IllegalArgumentException when depth is negative.
69 * @throws IllegalStateException when exiting would violate containment, typically by attempting
70 * to exit more levels than previously entered.
75 * Close this cursor. Attempting any further operations on the cursor will lead to undefined