Force ReadOperations (and TypedReadTransaction) to be implemented 79/84479/1
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 15 Sep 2019 18:47:23 +0000 (20:47 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 15 Sep 2019 18:47:23 +0000 (20:47 +0200)
This removes the default implementation, forcing all implementations
to consider this method.

Change-Id: I1f7c9f0a66a5b4c9f95d8f1f9f82691df8a70515
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ReadOperations.java
binding/mdsal-binding-util/src/main/java/org/opendaylight/mdsal/binding/util/TypedReadTransaction.java

index 13c50f00948844ddbae6289d98b24008e63d2748..700a59f40c36a505827f3a7d4a3e9885cbac66f9 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.mdsal.binding.api;
 
 import com.google.common.util.concurrent.FluentFuture;
-import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
@@ -67,8 +66,5 @@ public interface ReadOperations {
      * @throws IllegalArgumentException if the path is {@link InstanceIdentifier#isWildcarded()} and the implementation
      *                                  does not support evaluating wildcards.
      */
-    default @NonNull FluentFuture<Boolean> exists(final @NonNull LogicalDatastoreType store,
-            final @NonNull InstanceIdentifier<?> path) {
-        return read(store, path).transform(Optional::isPresent, MoreExecutors.directExecutor());
-    }
+    @NonNull FluentFuture<Boolean> exists(@NonNull LogicalDatastoreType store, @NonNull InstanceIdentifier<?> path);
 }
index 845923191f191b6ae0123f8d2acecbf7c58d35eb..25cb823fd3e2fff4fb965ee9d98d5094215d75f3 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.mdsal.binding.util;
 
 import com.google.common.util.concurrent.FluentFuture;
-import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Optional;
 import org.opendaylight.mdsal.binding.api.ReadTransaction;
 import org.opendaylight.mdsal.binding.api.Transaction;
@@ -37,16 +36,12 @@ public interface TypedReadTransaction<D extends Datastore> extends Transaction {
     <T extends DataObject> FluentFuture<Optional<T>> read(InstanceIdentifier<T> path);
 
     /**
-     * Determines if an object exists at the given path. Default implementation just delegates to
-     * {@link #read(InstanceIdentifier)}. Implementations are recommended to override with a more efficient
-     * implementation.
+     * Determines if an object exists at the given path.
      *
      * @see ReadTransaction#exists(LogicalDatastoreType, InstanceIdentifier)
      *
      * @param path The path to read from.
      * @return A future providing access to the result of the check, when it’s available, or any error encountered.
      */
-    default FluentFuture<Boolean> exists(final InstanceIdentifier<?> path) {
-        return read(path).transform(Optional::isPresent, MoreExecutors.directExecutor());
-    }
+    FluentFuture<Boolean> exists(InstanceIdentifier<?> path);
 }