2 * Copyright (c) 2016 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.restconf.common.patch;
10 import static java.util.Objects.requireNonNull;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.patch.rev170222.yang.patch.yang.patch.Edit.Operation;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 public class PatchEntity {
17 private final Operation operation;
18 private final String editId;
19 private final YangInstanceIdentifier targetNode;
20 private final NormalizedNode node;
23 * Constructor to create PatchEntity for Patch operations which require value leaf representing data to be present.
24 * @param editId Id of Patch edit
25 * @param operation Patch edit operation
26 * @param targetNode Target node for Patch edit operation
27 * @param node Data defined by value leaf used by edit operation
29 public PatchEntity(final String editId, final Operation operation, final YangInstanceIdentifier targetNode,
30 final NormalizedNode node) {
31 this.editId = requireNonNull(editId);
32 this.operation = requireNonNull(operation);
33 this.targetNode = requireNonNull(targetNode);
34 this.node = requireNonNull(node);
38 * Constructor to create PatchEntity for Patch operations which do not allow value leaf representing data to be
39 * present. <code>node</code> is set to <code>null</code> meaning that data are not allowed for edit operation.
40 * @param editId Id of Patch edit
41 * @param operation Patch edit operation
42 * @param targetNode Target node for Patch edit operation
44 public PatchEntity(final String editId, final Operation operation, final YangInstanceIdentifier targetNode) {
45 this.editId = requireNonNull(editId);
46 this.operation = requireNonNull(operation);
47 this.targetNode = requireNonNull(targetNode);
51 public Operation getOperation() {
55 public String getEditId() {
59 public YangInstanceIdentifier getTargetNode() {
63 public NormalizedNode getNode() {