### Question:
ReflectionUtil { public static <T> T convertValueMapValue(ValueMap valueMap, String name, Type declaredType) { return (T) new ValueMapTypeConverter(valueMap, name, declaredType).getConvertedValue(); } private  ReflectionUtil(); static T convertValueMapValue(ValueMap valueMap, String name, Type declaredType); static T convertValueMapValue(InheritanceValueMap valueMap, String name, Type declaredType); static T[] toArray(Collection<T> c, T[] a); static T[] toArray(Collection<T> c, Class klass); static T[] toArray(Collection<T> c); static boolean isArray(Type declaredType); static boolean isArray(Class<?> clazz); static boolean isCollectionType(Type declaredType); static boolean isCollectionType(Class<?> collectionType); static boolean isSetType(Type declaredType); static boolean isSetType(Class<?> collectionType); static boolean isListType(Type declaredType); static boolean isListType(Class<?> collectionType); static Class<?> getClassOrGenericParam(Type type); static boolean isAssignableFrom(Type assignableFromType, Class<?> clazz); static boolean hasGenericParameter(Type type); static Class<?> getGenericParameter(Type type); static Class<?> getGenericParameter(Type type, int index); static Object castStringValue(String allowedValue);  }### Answer:
@Test public void convertValueMapValue() { Integer myIntegerField = ReflectionUtil.convertValueMapValue(valueMap, "myIntegerField", Integer.class); assertEquals(22, myIntegerField.intValue()); Integer[] myIntegerArray = ReflectionUtil.convertValueMapValue(valueMap, "myIntegerArray", Integer[].class); assertEquals(2, myIntegerArray.length); assertEquals(33, myIntegerArray[1].intValue()); Double[] myDoubleArray = ReflectionUtil.convertValueMapValue(valueMap, "myDoubleArray", Double[].class); assertEquals(2, myDoubleArray.length); assertEquals(22.22, myDoubleArray[1], 0); }
@Test public void test_inheritanceValueMap() { InheritanceValueMap inheritanceValueMap = new HierarchyNodeInheritanceValueMap(valueMap); Integer myInheritedIntegerField = ReflectionUtil.convertValueMapValue(inheritanceValueMap, "myIntegerField", Integer.class); assertEquals(22, myInheritedIntegerField.intValue()); }