Reduce ObjectRegistration use
[mdsal.git] / binding / mdsal-binding-api / src / main / java / org / opendaylight / mdsal / binding / api / ActionProviderService.java
index 3f4e737fd133cbe636270eabe0f8cddb59668564..7a1ee8cb117ab7276d9d8dfce26dee6e350c12b4 100644 (file)
@@ -7,12 +7,11 @@
  */
 package org.opendaylight.mdsal.binding.api;
 
-import com.google.common.annotations.Beta;
 import com.google.common.collect.ImmutableSet;
 import java.util.Set;
-import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.Action;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -22,37 +21,34 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * and implementations can be invoked  dynamically at runtime, via {@link ActionService}. Implementations registered
  * with this interface may throw {@link IllegalArgumentException}s when they encounter inconsistent input data and
  * {@link IllegalStateException} in they are unable to service the request.
- *
- * @author Robert Varga
  */
-@Beta
-@NonNullByDefault
 public interface ActionProviderService extends BindingService {
     /**
      * Register an implementation of an action, potentially constrained to a set of nodes.
      *
-     * @param actionInterface Generated Action interface
+     * @param spec Action instance specification
      * @param implementation Implementation of {@code actionInterface}
      * @param datastore {@link LogicalDatastoreType} on which the implementation operates
      * @param validNodes Set of nodes this implementation is constrained to, empty if this implementation can handle
      *                   any target node.
-     * @return An {@link ObjectRegistration}
+     * @return A {@link Registration}
      * @throws NullPointerException if any of the arguments is null
      * @throws IllegalArgumentException if any of the {@code validNodes} does not match {@code datastore}
      * @throws UnsupportedOperationException if this service cannot handle requested datastore
      */
-    <O extends DataObject, P extends InstanceIdentifier<O>, T extends Action<P, ?, ?>, S extends T>
-        ObjectRegistration<S> registerImplementation(Class<T> actionInterface, S implementation,
-                LogicalDatastoreType datastore, Set<DataTreeIdentifier<O>> validNodes);
+    <P extends DataObject, A extends Action<? extends InstanceIdentifier<P>, ?, ?>>
+        @NonNull Registration registerImplementation(@NonNull ActionSpec<A, P> spec, @NonNull A implementation,
+            @NonNull LogicalDatastoreType datastore, @NonNull Set<? extends InstanceIdentifier<P>> validNodes);
 
-    default <O extends DataObject, P extends InstanceIdentifier<O>, T extends Action<P, ?, ?>, S extends T>
-        ObjectRegistration<S> registerImplementation(final Class<T> actionInterface, final S implementation,
-                final LogicalDatastoreType datastore) {
-        return registerImplementation(actionInterface, implementation, datastore, ImmutableSet.of());
+    default <P extends DataObject, A extends Action<? extends InstanceIdentifier<P>, ?, ?>>
+        @NonNull Registration registerImplementation(final @NonNull ActionSpec<A, P> spec,
+            final @NonNull A implementation, final @NonNull LogicalDatastoreType datastore) {
+        return registerImplementation(spec, implementation, datastore, ImmutableSet.of());
     }
 
-    default <O extends DataObject, P extends InstanceIdentifier<O>, T extends Action<P, ?, ?>, S extends T>
-        ObjectRegistration<S> registerImplementation(final Class<T> actionInterface, final S implementation) {
-        return registerImplementation(actionInterface, implementation, LogicalDatastoreType.OPERATIONAL);
+    default <P extends DataObject, A extends Action<? extends InstanceIdentifier<P>, ?, ?>>
+            @NonNull Registration registerImplementation(final @NonNull ActionSpec<A, P> spec,
+                final @NonNull A implementation) {
+        return registerImplementation(spec, implementation, LogicalDatastoreType.OPERATIONAL);
     }
 }