@Test public void testFindQueryParam() throws NoSuchMethodException { Method httpMethod = RESTReflectTest.class.getMethod("httpMethod", String.class, Integer.class, Page.class); Map<String, String> queryParams = RESTReflect.findQueryParams("http: Assertions.assertThat(queryParams).containsOnlyKeys("foo", "pageIndex", "pageSize"); }
static Map<String, String> findQueryParams(String baseParam, Method method) { Map<String, String> hrefVars = new HashMap<>(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = 0; i < parameterAnnotations.length; i++) { Annotation[] paramAnnotations = parameterAnnotations[i]; for (Annotation paramAnnotation : paramAnnotations) { Class<?> parameterClass = method.getParameterTypes()[i]; hrefVars.putAll(findQueryParamOnParameter(baseParam, parameterClass, paramAnnotation)); } } return hrefVars; }
RESTReflect { static Map<String, String> findQueryParams(String baseParam, Method method) { Map<String, String> hrefVars = new HashMap<>(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = 0; i < parameterAnnotations.length; i++) { Annotation[] paramAnnotations = parameterAnnotations[i]; for (Annotation paramAnnotation : paramAnnotations) { Class<?> parameterClass = method.getParameterTypes()[i]; hrefVars.putAll(findQueryParamOnParameter(baseParam, parameterClass, paramAnnotation)); } } return hrefVars; } }
RESTReflect { static Map<String, String> findQueryParams(String baseParam, Method method) { Map<String, String> hrefVars = new HashMap<>(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = 0; i < parameterAnnotations.length; i++) { Annotation[] paramAnnotations = parameterAnnotations[i]; for (Annotation paramAnnotation : paramAnnotations) { Class<?> parameterClass = method.getParameterTypes()[i]; hrefVars.putAll(findQueryParamOnParameter(baseParam, parameterClass, paramAnnotation)); } } return hrefVars; } private  RESTReflect(); }
RESTReflect { static Map<String, String> findQueryParams(String baseParam, Method method) { Map<String, String> hrefVars = new HashMap<>(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = 0; i < parameterAnnotations.length; i++) { Annotation[] paramAnnotations = parameterAnnotations[i]; for (Annotation paramAnnotation : paramAnnotations) { Class<?> parameterClass = method.getParameterTypes()[i]; hrefVars.putAll(findQueryParamOnParameter(baseParam, parameterClass, paramAnnotation)); } } return hrefVars; } private  RESTReflect();  }
RESTReflect { static Map<String, String> findQueryParams(String baseParam, Method method) { Map<String, String> hrefVars = new HashMap<>(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = 0; i < parameterAnnotations.length; i++) { Annotation[] paramAnnotations = parameterAnnotations[i]; for (Annotation paramAnnotation : paramAnnotations) { Class<?> parameterClass = method.getParameterTypes()[i]; hrefVars.putAll(findQueryParamOnParameter(baseParam, parameterClass, paramAnnotation)); } } return hrefVars; } private  RESTReflect();   }