use of com.webobjects.foundation.NSSet in project wonder-slim by undur.
the class NSSetSerializer method marshall.
public Object marshall(SerializerState state, Object p, Object o) throws MarshallException {
try {
NSSet set = (NSSet) o;
JSONObject obj = new JSONObject();
JSONObject setdata = new JSONObject();
obj.put("javaClass", o.getClass().getName());
obj.put("set", setdata);
String key = null;
try {
int index = 0;
Enumeration i = set.objectEnumerator();
while (i.hasMoreElements()) {
Object value = i.nextElement();
setdata.put(key, ser.marshall(state, o, value, Integer.valueOf(index)));
index++;
}
} catch (MarshallException e) {
throw new MarshallException("set key " + key + e.getMessage());
}
return obj;
} catch (JSONException e) {
throw new MarshallException("Failed to marshall NSSet.", e);
}
}
Aggregations