2 * Copyright © 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.util;
10 import javax.annotation.Nonnull;
11 import org.opendaylight.mdsal.binding.api.WriteTransaction;
12 import org.opendaylight.yangtools.yang.binding.DataObject;
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 * Implementation of {@link TypedWriteTransaction}.
18 * @param <D> The datastore which the transaction targets.
20 class TypedWriteTransactionImpl<D extends Datastore> extends TypedTransaction<D>
21 implements TypedWriteTransaction<D> {
22 // Temporarily package protected for TransactionAdapter
23 final WriteTransaction delegate;
25 TypedWriteTransactionImpl(Class<D> datastoreType, WriteTransaction realTx) {
27 this.delegate = realTx;
31 public <T extends DataObject> void put(InstanceIdentifier<T> path, T data) {
32 delegate.put(getDatastoreType(), path, data);
36 public <T extends DataObject> void put(InstanceIdentifier<T> path, T data, boolean createMissingParents) {
37 delegate.put(getDatastoreType(), path, data, createMissingParents);
41 public <T extends DataObject> void merge(InstanceIdentifier<T> path, T data) {
42 delegate.merge(getDatastoreType(), path, data);
46 public <T extends DataObject> void merge(InstanceIdentifier<T> path, T data, boolean createMissingParents) {
47 delegate.merge(getDatastoreType(), path, data, createMissingParents);
51 public void delete(InstanceIdentifier<?> path) {
52 delegate.delete(getDatastoreType(), path);
57 public Object getIdentifier() {
58 return delegate.getIdentifier();