class MapUtils {

    @SuppressWarnings("unchecked")
    static String[] getStringArray(Map<String, Object> map, String key) {
        Object value = map.get(key);
        if (value instanceof List)
            return toStringArray((List<Object>) value);
        else if (!value.getClass().isArray())
            return new String[]{value.toString()};
        else if (value.getClass().getComponentType() == String.class)
            return (String[]) value;
        else
            throw createBadTypeException(key, value, "an array of strings");
    }

}