nashorn maps js-array to java-map

This commit is contained in:
Peter Hormanns 2017-12-29 19:13:24 +01:00
parent e52b8d7308
commit c4f3025c80

View File

@ -2,6 +2,7 @@ package de.hsadmin.module.property.mapping;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.Set;
import de.hsadmin.common.error.TechnicalException; import de.hsadmin.common.error.TechnicalException;
import de.hsadmin.common.error.UserException; import de.hsadmin.common.error.UserException;
@ -35,6 +36,16 @@ public class DefaultStringSetParameterMapMapper implements
idx++; idx++;
} }
} }
if (rpcParam instanceof Map<?, ?>) {
final Map<?, ?> rpcParamMap = (Map<?, ?>) rpcParam;
final Set<?> keySet = rpcParamMap.keySet();
strings = new String[rpcParamMap.size()];
for (int idx = 0; idx < strings.length; idx++) {
final Object object = keySet.toArray()[idx];
final String val = (String) rpcParamMap.get(object);
strings[idx] = val;
}
}
value.setStrings(strings); value.setStrings(strings);
return value; return value;
} }