StringToArrayConverter implements StringToMultiValueConverter { @Override public Object convert(String[] segments, int size, Class<?> targetType, Class<?> elementType) { Class<?> componentType = targetType.getComponentType(); Converter converter = Converter.getConverter(String.class, componentType); Object array = newInstance(componentType, size); for (int i = 0; i < size; i++) { Array.set(array, i, converter.convert(segments[i])); } return array; }  boolean accept(Class<String> type, Class<?> multiValueType); @Override Object convert(String[] segments, int size, Class<?> targetType, Class<?> elementType); @Override int getPriority();  }
@Test public void testConvert() { assertTrue(deepEquals(new Integer[]{123}, converter.convert("123", Integer[].class, Integer.class))); assertTrue(deepEquals(new Integer[]{1, 2, 3}, converter.convert("1,2,3", Integer[].class, null))); assertNull(converter.convert("", Integer[].class, null)); assertNull(converter.convert(null, Integer[].class, null)); }