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.ReadTransaction;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 * Implementation of {@link TypedReadTransaction}.
19 * @param <D> The datastore which the transaction targets.
21 class TypedReadTransactionImpl<D extends Datastore> extends TypedTransaction<D>
22 implements TypedReadTransaction<D> {
23 private final ReadTransaction delegate;
25 TypedReadTransactionImpl(Class<D> datastoreType, ReadTransaction realTx) {
27 this.delegate = realTx;
31 public <T extends DataObject> FluentFuture<Optional<T>> read(InstanceIdentifier<T> path) {
32 return FluentFuture.from(delegate.read(getDatastoreType(), path));
36 public FluentFuture<Boolean> exists(InstanceIdentifier<?> path) {
37 return FluentFuture.from(delegate.exists(getDatastoreType(), path));
41 public Object getIdentifier() {
42 return delegate.getIdentifier();