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.api.schema.tree.spi;
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
16 * A mutable tree node. This is a transient view materialized from a pre-existing node. Modifications are isolated. Once
17 * this object is {@link #seal()}ed, any interactions with it will result in undefined behavior.
19 // FIXME: 5.0.0: Use @NonNullByDefault
20 public interface MutableTreeNode extends StoreTreeNode<TreeNode> {
22 * Set the data component of the node.
24 * @param data New data component, may not be null.
25 * @throws NullPointerException if {@code data} is null
27 void setData(NormalizedNode<?, ?> data);
30 * Set the new subtree version. This is typically invoked when the user
31 * has modified some of this node's children.
33 * @param subtreeVersion New subtree version.
34 * @throws NullPointerException if {@code subtreeVersion} is null
36 void setSubtreeVersion(Version subtreeVersion);
39 * Add a new child node. This acts as add-or-replace operation, e.g. it
40 * succeeds even if a conflicting child is already present.
42 * @param child New child node.
43 * @throws NullPointerException if {@code child} is null
45 void addChild(TreeNode child);
48 * Remove a child node. This acts as delete-or-nothing operation, e.g. it
49 * succeeds even if the corresponding child is not present.
51 * @param id Child identifier.
52 * @throws NullPointerException if {@code id} is null
54 void removeChild(PathArgument id);
57 * Finish node modification and return a read-only view of this node. After
58 * this method is invoked, any further calls to this object's method result
59 * in undefined behavior.
61 * @return Read-only view of this node.
63 @NonNull TreeNode seal();