2 * Copyright © 2017, 2018 Red Hat, Inc. and others.
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.binding.spi;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.util.concurrent.FluentFuture;
13 import org.opendaylight.mdsal.binding.api.WriteTransaction;
14 import org.opendaylight.mdsal.common.api.CommitInfo;
15 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
20 * Utility {@link WriteTransaction} implementation which forwards all interface method
21 * invocation to a delegate instance.
23 public class ForwardingWriteTransaction extends ForwardingTransaction implements WriteTransaction {
24 private final WriteTransaction delegate;
26 public ForwardingWriteTransaction(final WriteTransaction delegate) {
27 this.delegate = requireNonNull(delegate);
31 protected WriteTransaction delegate() {
36 public <T extends DataObject> void put(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
38 delegate.put(store, path, data);
42 public <T extends DataObject> void put(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
43 final T data, final boolean createMissingParents) {
44 delegate.put(store, path, data, createMissingParents);
48 public <T extends DataObject> void merge(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
50 delegate.merge(store, path, data);
54 public <T extends DataObject> void merge(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
55 final T data, final boolean createMissingParents) {
56 delegate.merge(store, path, data, createMissingParents);
60 public void delete(final LogicalDatastoreType store, final InstanceIdentifier<?> path) {
61 delegate.delete(store, path);
65 public boolean cancel() {
66 return delegate.cancel();
70 public FluentFuture<? extends CommitInfo> commit() {
71 return delegate.commit();