public Class[] getSerializableClasses() {
return _serializableClasses;
}
public Object marshall(SerializerState state, Object p, Object o) throws MarshallException {
NSDictionary dictionary = (NSDictionary) o;
JSONObject obj = new JSONObject();
JSONObject dictionarydata = new JSONObject();
if (ser.getMarshallClassHints()) {
try {
obj.put("javaClass", o.getClass().getName());
}
catch (JSONException e) {
throw new MarshallException("javaClass not found!");
}
}
try {
obj.put("nsdictionary", dictionarydata);
state.push(o, dictionarydata, "nsdictionary");
}
catch (JSONException e) {
throw new MarshallException("Could not add nsdictionary to object: " + e.getMessage());
}
Object key = null;
try {
Enumeration keyEnum = dictionary.allKeys().objectEnumerator();
while (keyEnum.hasMoreElements()) {
key = keyEnum.nextElement();
Object value = dictionary.objectForKey(key);
String keyString = key.toString(); // only support String keys
Object json = ser.marshall(state, dictionarydata, value, keyString);
// omit the object entirely if it's a circular reference or duplicate