import org.json.simple.JSONObject; import java.io.File; class MCutResult { class Cut { public enum ContentType {FILENAME, BAD_REQUEST, SERVICE_ERROR}; public Inputs inputs; public int index; public ContentType contentType; public String content; JSONObject toJsonObject() { JSONObject jo = new JSONObject(); //jo.put("input", inputs.toJsonObject()); jo.put("type", contentType.toString()); jo.put("content", content); return jo; } void deleteFile() { if(contentType == ContentType.FILENAME) { File cutFile = new File(content); cutFile.delete(); } } } void deleteResJson() { if(resJsonPathname != null) { File resJson = new File(resJsonPathname); resJson.delete(); } } public void deleteCutFiles() { for(Cut cut : cutResArr) { cut.deleteFile(); } } public String fileName; public String resJsonPathname; public long fileSize; Cut[] cutResArr; }