Beans { public static void setPropertiesNestable(BeanType beanType, Object bean, Map<String, Object> map) { Args.notNull(bean,"bean"); setPropertiesNestableInternal(beanType, bean, map); } protected  Beans(); static boolean isSimpleProperty(Class<?> clazz); static boolean isSetterMethod(String methodName); static boolean isGetterMethod(String methodName); static String extractPropertyFromSetter(String methodName); static String extraPropertyFromGetter(String methodName); static Map<String,Object> toMap(Object bean); static T copyNew(T from); static void copyProperties(Object from,Object to); static Object getProperty(BeanType beanType,Object bean,String property); static Object getNestableProperty(Object bean,String property); static Object getNestableProperty(Map map, String property); static Object getNestableProperty(BeanType beanType, Object bean, String property); static T fromMapNestable(BeanType beanType, Map<String, Object> map); static void setProperties(BeanType beanType,Object bean,Map<String, Object> map); static void setPropertiesNestable(BeanType beanType, Object bean, Map<String, Object> map); static void setProperty(BeanType beanType,Object bean,String property,Object value); static void setProperty(BeanType beanType,Object bean,String property,Object value, boolean ignoreCase); static final String SETTER_PREFIX; static final String GETTER_PREFIX; static final String IS_PREFIX; }
@Test public void testSetBeanPropertyWithArray(){ BeanType bt = BeanType.of(TestedBean.class); TestedBean tb = new TestedBean(); Map<String, Object> properties = New.hashMap(); String[] strArray = new String[3]; strArray[0] = "str0"; strArray[1] = "str1"; strArray[2] = "str2"; Integer[] intArray = new Integer[3]; intArray[0] = 0; intArray[1] = 1; intArray[2] = 2; properties.put("strArray[]", strArray); properties.put("intArray[]", intArray); properties.put("strArray1[0]", strArray[2]); properties.put("strArray1[1]", strArray[1]); properties.put("strArray1[2]", strArray[0]); properties.put("intArray1[0]", intArray[2]); properties.put("intArray1[1]", intArray[1]); properties.put("intArray1[2]", intArray[0]); Beans.setPropertiesNestable(bt,tb,properties); assertEquals(strArray[0], tb.getStrArray()[0]); assertEquals(strArray[1], tb.getStrArray()[1]); assertEquals(strArray[2], tb.getStrArray()[2]); assertEquals(intArray[0], tb.getIntArray()[0]); assertEquals(intArray[1], tb.getIntArray()[1]); assertEquals(intArray[2], tb.getIntArray()[2]); assertEquals(strArray[0], tb.getStrArray1()[2]); assertEquals(strArray[1], tb.getStrArray1()[1]); assertEquals(strArray[2], tb.getStrArray1()[0]); assertEquals(intArray[0], tb.getIntArray1()[2]); assertEquals(intArray[1], tb.getIntArray1()[1]); assertEquals(intArray[2], tb.getIntArray1()[0]); }