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.genius.infra;
10 import com.google.common.util.concurrent.FluentFuture;
11 import java.util.Optional;
12 import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 * Implementation of {@link TypedReadWriteTransaction}.
19 * @param <D> The datastore which the transaction targets.
21 class TypedReadWriteTransactionImpl<D extends Datastore>
22 extends TypedWriteTransactionImpl<D>
23 implements TypedReadWriteTransaction<D> {
24 // Temporarily package protected for TransactionAdapter
25 final ReadWriteTransaction delegate;
27 TypedReadWriteTransactionImpl(Class<D> datastoreType, ReadWriteTransaction realTx) {
28 super(datastoreType, realTx);
29 this.delegate = realTx;
33 public <T extends DataObject> FluentFuture<Optional<T>> read(InstanceIdentifier<T> path) {
34 return delegate.read(getDatastoreType(), path);
38 public FluentFuture<Boolean> exists(InstanceIdentifier<?> path) {
39 return delegate.exists(getDatastoreType(), path);