public static Map mapArrayToList()

in src/main/java/org/apache/sling/nosql/generic/adapter/MapConverter.java [42:64]


    public static Map<String, Object> mapArrayToList(Map<String, Object> map) {
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            if (entry.getValue().getClass().isArray()) {
                Class componentType = entry.getValue().getClass().getComponentType();
                if (componentType == int.class) {
                    entry.setValue(Arrays.asList(ArrayUtils.toObject((int[]) entry.getValue())));
                }
                else if (componentType == long.class) {
                    entry.setValue(Arrays.asList(ArrayUtils.toObject((long[]) entry.getValue())));
                }
                else if (componentType == double.class) {
                    entry.setValue(Arrays.asList(ArrayUtils.toObject((double[]) entry.getValue())));
                }
                else if (componentType == boolean.class) {
                    entry.setValue(Arrays.asList(ArrayUtils.toObject((boolean[]) entry.getValue())));
                }
                else {
                    entry.setValue(Arrays.asList((Object[]) entry.getValue()));
                }
            }
        }
        return map;
    }