Remove BindingReflections.isRpcMethod() 91/106591/3
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 21 Jun 2023 12:40:58 +0000 (14:40 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 21 Jun 2023 16:22:42 +0000 (18:22 +0200)
This method is not used anywhere, remove it.

JIRA: MDSAL-781
Change-Id: I706eac66d496ae8f52c9a98b004d1906e6165e43
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-spec-util/src/main/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflections.java
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/reflect/BindingReflectionsTest.java

index b3c9be6eea0b641d86741833599666b8bc6b19a1..be9704c2de2a0cd0e6da7e0e36decc6ada02ca20 100644 (file)
@@ -14,7 +14,6 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -30,7 +29,6 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.binding.Rpc;
-import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.contract.Naming;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -62,23 +60,6 @@ public final class BindingReflections {
         return CLASS_TO_QNAME.getUnchecked(dataType).orElse(null);
     }
 
-    /**
-     * Checks if method is RPC invocation.
-     *
-     * @param possibleMethod
-     *            Method to check
-     * @return true if method is RPC invocation, false otherwise.
-     */
-    public static boolean isRpcMethod(final Method possibleMethod) {
-        return possibleMethod != null && RpcService.class.isAssignableFrom(possibleMethod.getDeclaringClass())
-                && ListenableFuture.class.isAssignableFrom(possibleMethod.getReturnType())
-                // length <= 2: it seemed to be impossible to get correct RpcMethodInvoker because of
-                // resolveRpcInputClass() check.While RpcMethodInvoker counts with one argument for
-                // non input type and two arguments for input type, resolveRpcInputClass() counting
-                // with zero for non input and one for input type
-                && possibleMethod.getParameterCount() <= 2;
-    }
-
     public static @NonNull QName getQName(final BaseIdentity identity) {
         return getContractQName(identity);
     }
index 066a293bece066cfa1094f53957179a2859df3e0..83b19615552b9b5a70773366d7a985a1b8be5786 100644 (file)
@@ -28,8 +28,6 @@ public class BindingReflectionsTest {
         assertTrue("Should be BindingClass", BindingReflections.isBindingClass(DataObject.class));
         assertFalse("Should not be Notification", BindingReflections.isNotification(DataObject.class));
 
-        assertTrue(BindingReflections.isRpcMethod(TestImplementation.class.getDeclaredMethod("rpcMethodTest")));
-
         assertEquals(QName.create("test", "test"), BindingReflections.getQName(TestIdentity.VALUE));
     }