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.netconf.mdsal.connector.ops;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.base.MoreObjects;
13 import com.google.common.collect.ImmutableList;
14 import com.google.common.collect.ImmutableList.Builder;
15 import java.util.Deque;
16 import org.opendaylight.netconf.api.ModifyAction;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
21 public final class DataTreeChange {
22 private final NormalizedNode changeRoot;
23 private final YangInstanceIdentifier path;
24 private final ModifyAction action;
26 DataTreeChange(final NormalizedNode changeRoot, final ModifyAction action, final Deque<PathArgument> path) {
27 this.changeRoot = requireNonNull(changeRoot);
28 this.action = requireNonNull(action);
30 final Builder<PathArgument> builder = ImmutableList.builderWithExpectedSize(path.size());
31 path.descendingIterator().forEachRemaining(builder::add);
32 this.path = YangInstanceIdentifier.create(builder.build());
35 public NormalizedNode getChangeRoot() {
39 public ModifyAction getAction() {
43 public YangInstanceIdentifier getPath() {
48 public String toString() {
49 return MoreObjects.toStringHelper(this).add("action", action).add("path", path).add("root", changeRoot)