Remove superfluous FluentFuture adaptation
[genius.git] / mdsalutil / mdsalutil-api / src / main / java / org / opendaylight / genius / infra / TypedReadWriteTransactionImpl.java
1 /*
2  * Copyright © 2018 Red Hat, Inc. and others.
3  *
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
7  */
8 package org.opendaylight.genius.infra;
9
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;
15
16 /**
17  * Implementation of {@link TypedReadWriteTransaction}.
18  *
19  * @param <D> The datastore which the transaction targets.
20  */
21 class TypedReadWriteTransactionImpl<D extends Datastore>
22         extends TypedWriteTransactionImpl<D>
23         implements TypedReadWriteTransaction<D> {
24     // Temporarily package protected for TransactionAdapter
25     final ReadWriteTransaction delegate;
26
27     TypedReadWriteTransactionImpl(Class<D> datastoreType, ReadWriteTransaction realTx) {
28         super(datastoreType, realTx);
29         this.delegate = realTx;
30     }
31
32     @Override
33     public <T extends DataObject> FluentFuture<Optional<T>> read(InstanceIdentifier<T> path) {
34         return delegate.read(getDatastoreType(), path);
35     }
36
37     @Override
38     public FluentFuture<Boolean> exists(InstanceIdentifier<?> path) {
39         return delegate.exists(getDatastoreType(), path);
40     }
41 }