@Test(expected = IllegalRetryException.class) public void testValidateRetryFunctionWithMap() { RetryHandlerUtils.validateRetryFunction(getMethodByName(OrderService.class, "payment6")); }
public static void validateRetryFunction(Method method) { if (method.getParameterCount() != 1) { throw new IllegalRetryException(method.toString() + ": 重试方法有且只能有一个参数"); } Class<?> clazz = method.getParameterTypes()[0]; if (Object.class.equals(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是Object或其他不能序列化和反序列化的类型"); } else if (Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是集合类等带泛型的"); } }
RetryHandlerUtils { public static void validateRetryFunction(Method method) { if (method.getParameterCount() != 1) { throw new IllegalRetryException(method.toString() + ": 重试方法有且只能有一个参数"); } Class<?> clazz = method.getParameterTypes()[0]; if (Object.class.equals(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是Object或其他不能序列化和反序列化的类型"); } else if (Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是集合类等带泛型的"); } } }
RetryHandlerUtils { public static void validateRetryFunction(Method method) { if (method.getParameterCount() != 1) { throw new IllegalRetryException(method.toString() + ": 重试方法有且只能有一个参数"); } Class<?> clazz = method.getParameterTypes()[0]; if (Object.class.equals(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是Object或其他不能序列化和反序列化的类型"); } else if (Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是集合类等带泛型的"); } } private  RetryHandlerUtils(); }
RetryHandlerUtils { public static void validateRetryFunction(Method method) { if (method.getParameterCount() != 1) { throw new IllegalRetryException(method.toString() + ": 重试方法有且只能有一个参数"); } Class<?> clazz = method.getParameterTypes()[0]; if (Object.class.equals(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是Object或其他不能序列化和反序列化的类型"); } else if (Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是集合类等带泛型的"); } } 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 void validateRetryFunction(Method method) { if (method.getParameterCount() != 1) { throw new IllegalRetryException(method.toString() + ": 重试方法有且只能有一个参数"); } Class<?> clazz = method.getParameterTypes()[0]; if (Object.class.equals(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是Object或其他不能序列化和反序列化的类型"); } else if (Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz)) { throw new IllegalRetryException(method.toString() + ": 重试方法的参数类型不能是集合类等带泛型的"); } } 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);  }