obj.put("id", id);
obj.put("mime-type", mimeType);
if (options != null)
obj.put("options", options);
if (fragments.size() > 0) {
JSONArray array = new JSONArray();
for (FragmentDescriptor fd : fragments) {
JSONObject o = new JSONObject();
o.put("type", fd instanceof ExternalFragment ? "file" : "script");
if (fd instanceof ExternalFragment) o.put("file", ((ExternalFragment) fd).getFilePath());
else o.put("text", ((InternalFragment) fd).getText());
array.put(o);
}
obj.put("fragments", array);
}
if (dependentFragments != null && dependentFragments.size() > 0) {
JSONArray array = new JSONArray();
for (FragmentDescriptor fd : dependentFragments) {
JSONObject o = new JSONObject();
o.put("file", fd.toString());
array.put(o);
}
obj.put("dependency", array);
}
return obj.toString() + "\n";
}