int i = 0;
for (Iterator<Map.Entry<Object, Object>> iter = objects.entrySet().iterator();
iter.hasNext();) {
Map.Entry entry = iter.next();
Object value = entry.getValue();
Attachment handler = createDataHandler(value, value.getClass(), value.getClass(),
new Annotation[]{},
entry.getKey().toString(),
mt.toString(),
i++);
handlers.add(handler);
}
return handlers;
} else {
String rootMediaType = getRootMediaType(anns, mt);
if (List.class.isAssignableFrom(obj.getClass())) {
return getAttachments((List)obj, rootMediaType);
} else {
if (MultipartBody.class.isAssignableFrom(type)) {
List<Attachment> atts = ((MultipartBody)obj).getAllAttachments();
// these attachments may have no DataHandlers, but objects only
return getAttachments(atts, rootMediaType);
}
Attachment handler = createDataHandler(obj,
type, genericType, anns,
rootMediaType, mt.toString(), 1);
return Collections.singletonList(handler);
}
}