2 * Copyright (c) 2014 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.yangtools.yang.data.tree.api;
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15 * Class encapsulation of set of modifications to a base tree. This tree is backed by a read-only snapshot and tracks
16 * modifications on top of that. The modification has the ability to rebase itself to a new snapshot.
18 public interface DataTreeModification extends DataTreeSnapshot {
20 * Delete the node at specified path.
22 * @param path Node path
24 void delete(YangInstanceIdentifier path);
27 * Merge the specified data with the currently-present data at specified path.
29 * @param path Node path
30 * @param data Data to be merged
32 void merge(YangInstanceIdentifier path, NormalizedNode data);
35 * Replace the data at specified path with supplied data.
37 * @param path Node path
38 * @param data New node data
40 void write(YangInstanceIdentifier path, NormalizedNode data);
43 * Finish creation of a modification, making it ready for application to the data tree. Any calls to this object's
44 * methods except {@link #applyToCursor(DataTreeModificationCursor)} will result in undefined behavior, possibly
45 * with an {@link IllegalStateException} being thrown.
50 * Apply the contents of this modification to a cursor. This can be used to replicate this modification onto another
51 * one. The cursor's position must match the root of this modification, otherwise performing this operation will
52 * result in undefined behavior.
54 * @param cursor cursor to which this modification
56 void applyToCursor(@NonNull DataTreeModificationCursor cursor);