if (ovs == null)
{
ovs = new HashMap<String, OutboundVariable>();
}
ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx);
outctx.put(data, ov);
// Loop through the map outputting any init code and collecting
// converted outbound variables into the ovs map
Map<Object, Object> map = (Map<Object, Object>) data;
for (Entry<Object, Object> entry : map.entrySet())
{
Object key = entry.getKey();
Object value = entry.getValue();
// If the key is null, retrieve the configured null key value from the configuration of this converter.
if (null == key && null != nullKey) {
log.debug("MapConverter: A null key was encountered DWR is using the configured nullKey string: " + nullKey);
key = nullKey;
}
// It would be nice to check for Enums here
if (!(key instanceof String) && !sentNonStringWarning)
{
log.warn("--Javascript does not support non string keys. Converting '" + key.getClass().getName() + "' using toString()");
sentNonStringWarning = true;
}
String outkey = JavascriptUtil.escapeJavaScript(key.toString());
/*
OutboundVariable ovkey = converterManager.convertOutbound(key, outctx);
buffer.append(ovkey.getInitCode());
outkey = ovkey.getAssignCode();
*/
OutboundVariable nested = converterManager.convertOutbound(value, outctx);
ovs.put(outkey, nested);
}
ov.setChildren(ovs);
return ov;
}