@Test public void testIsRetryHandlerMethod() { Assertions.assertThat(RetryHandlerUtils.isRetryHandlerMethod(ObjectRetryHandler.class, getMethodByName(ObjectRetryHandler.class, "handle"))).isTrue(); Assertions.assertThat(RetryHandlerUtils.isRetryHandlerMethod(GenericRetryHandler.class, getMethodByName(GenericRetryHandler.class, "handle"))).isTrue(); }
public static boolean isRetryHandlerMethod(Class<?> targetClass, Method method) { if ("handle".equals(method.getName()) && method.getParameterCount() == 1 && method.isBridge() && method.isSynthetic()) { return true; } Type interfaceType = getRetryHandlerGenericInterface(targetClass); if (interfaceType == null) { return false; } Class<?> argsInputType = Object.class; if (interfaceType instanceof ParameterizedType) { argsInputType = (Class<?>) ((ParameterizedType) interfaceType).getActualTypeArguments()[0]; } Class<?> parameterType = argsInputType; return "handle".equals(method.getName()) && method.getParameterCount() == 1 && method.getParameterTypes()[0].equals(parameterType); }
RetryHandlerUtils { public static boolean isRetryHandlerMethod(Class<?> targetClass, Method method) { if ("handle".equals(method.getName()) && method.getParameterCount() == 1 && method.isBridge() && method.isSynthetic()) { return true; } Type interfaceType = getRetryHandlerGenericInterface(targetClass); if (interfaceType == null) { return false; } Class<?> argsInputType = Object.class; if (interfaceType instanceof ParameterizedType) { argsInputType = (Class<?>) ((ParameterizedType) interfaceType).getActualTypeArguments()[0]; } Class<?> parameterType = argsInputType; return "handle".equals(method.getName()) && method.getParameterCount() == 1 && method.getParameterTypes()[0].equals(parameterType); } }
RetryHandlerUtils { public static boolean isRetryHandlerMethod(Class<?> targetClass, Method method) { if ("handle".equals(method.getName()) && method.getParameterCount() == 1 && method.isBridge() && method.isSynthetic()) { return true; } Type interfaceType = getRetryHandlerGenericInterface(targetClass); if (interfaceType == null) { return false; } Class<?> argsInputType = Object.class; if (interfaceType instanceof ParameterizedType) { argsInputType = (Class<?>) ((ParameterizedType) interfaceType).getActualTypeArguments()[0]; } Class<?> parameterType = argsInputType; return "handle".equals(method.getName()) && method.getParameterCount() == 1 && method.getParameterTypes()[0].equals(parameterType); } private  RetryHandlerUtils(); }
RetryHandlerUtils { public static boolean isRetryHandlerMethod(Class<?> targetClass, Method method) { if ("handle".equals(method.getName()) && method.getParameterCount() == 1 && method.isBridge() && method.isSynthetic()) { return true; } Type interfaceType = getRetryHandlerGenericInterface(targetClass); if (interfaceType == null) { return false; } Class<?> argsInputType = Object.class; if (interfaceType instanceof ParameterizedType) { argsInputType = (Class<?>) ((ParameterizedType) interfaceType).getActualTypeArguments()[0]; } Class<?> parameterType = argsInputType; return "handle".equals(method.getName()) && method.getParameterCount() == 1 && method.getParameterTypes()[0].equals(parameterType); } private  RetryHandlerUtils(); static boolean isRetryFunctionMethod(Method method); static void validateRetryHandler(Class<?> clazz); static void validateRetryFunction(Method method); static boolean isRetryHandlerMethod(Class<?> targetClass, Method method); static Type getRetryHandlerGenericInterface(Class<?> clazz); static String getMethodIdentity(Method method); }
RetryHandlerUtils { public static boolean isRetryHandlerMethod(Class<?> targetClass, Method method) { if ("handle".equals(method.getName()) && method.getParameterCount() == 1 && method.isBridge() && method.isSynthetic()) { return true; } Type interfaceType = getRetryHandlerGenericInterface(targetClass); if (interfaceType == null) { return false; } Class<?> argsInputType = Object.class; if (interfaceType instanceof ParameterizedType) { argsInputType = (Class<?>) ((ParameterizedType) interfaceType).getActualTypeArguments()[0]; } Class<?> parameterType = argsInputType; return "handle".equals(method.getName()) && method.getParameterCount() == 1 && method.getParameterTypes()[0].equals(parameterType); } private  RetryHandlerUtils(); static boolean isRetryFunctionMethod(Method method); static void validateRetryHandler(Class<?> clazz); static void validateRetryFunction(Method method); static boolean isRetryHandlerMethod(Class<?> targetClass, Method method); static Type getRetryHandlerGenericInterface(Class<?> clazz); static String getMethodIdentity(Method method);  }