ParametersInstantiatorInterceptor implements Interceptor { public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException { Enumeration<String> names = request.getParameterNames(); while (names.hasMoreElements()) { fixParameter(names.nextElement()); } addHeaderParametersToAttribute(method); Object[] values = getParametersFor(method); validator.addAll(errors); if (!errors.isEmpty()) { logger.debug("There are conversion errors: {}", errors); } logger.debug("Parameter values for {} are {}", method, values); parameters.setParameters(values); stack.next(method, resourceInstance); } ParametersInstantiatorInterceptor(ParametersProvider provider, ParameterNameProvider parameterNameProvider, MethodInfo parameters,
		Validator validator, Localization localization, MutableRequest request, FlashScope flash); boolean accepts(ResourceMethod method); void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance);  }
@Test public void shouldConvertArrayParametersToIndexParameters() throws Exception { when(request.getParameterNames()).thenReturn(Collections.enumeration(Arrays.asList("someParam[].id", "unrelatedParam"))); when(request.getParameterValues("someParam[].id")).thenReturn(new String[] {"one", "two", "three"}); instantiator.intercept(stack, method, null); verify(request).setParameter("someParam[0].id", "one"); verify(request).setParameter("someParam[1].id", "two"); verify(request).setParameter("someParam[2].id", "three"); }
@Test(expected=IllegalArgumentException.class) public void shouldThrowExceptionWhenThereIsAParameterContainingDotClass() throws Exception { when(request.getParameterNames()).thenReturn(Collections.enumeration(Arrays.asList("someParam.class.id", "unrelatedParam"))); when(request.getParameterValues("someParam.class.id")).thenReturn(new String[] {"whatever"}); instantiator.intercept(stack, method, null); }