Source:
JSONObject toJson() throws JSONException { JSONObject metadata = new JSONObject(); switch (currentJsonVersion) { case JSON_VERSION_1: metadata.put(JSON_VERSION_KEY, JSON_VERSION_1); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(CONTAINER_LAST_UPDATE_TIME_KEY, lastUpdateTime); metadata.put(STATUS_KEY, status.name()); metadata.put(DESCRIPTION_KEY, description); metadata.put(IS_PRIVATE_KEY, !cacheable); metadata.put(PARENT_ACCOUNT_ID_KEY, parentAccountId); break; case JSON_VERSION_2: metadata.put(Container.JSON_VERSION_KEY, JSON_VERSION_2); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(CONTAINER_LAST_UPDATE_TIME_KEY, lastUpdateTime); metadata.put(Container.STATUS_KEY, status.name()); metadata.put(DESCRIPTION_KEY, description); metadata.put(ENCRYPTED_KEY, encrypted); metadata.put(PREVIOUSLY_ENCRYPTED_KEY, previouslyEncrypted); metadata.put(CACHEABLE_KEY, cacheable); metadata.put(BACKUP_ENABLED_KEY, backupEnabled); metadata.put(MEDIA_SCAN_DISABLED_KEY, mediaScanDisabled); metadata.putOpt(REPLICATION_POLICY_KEY, replicationPolicy); metadata.put(TTL_REQUIRED_KEY, ttlRequired); metadata.put(SECURE_PATH_REQUIRED_KEY, securePathRequired); if (contentTypeWhitelistForFilenamesOnDownload != null && !contentTypeWhitelistForFilenamesOnDownload.isEmpty()) { JSONArray contentTypeWhitelistForFilenamesOnDownloadJson = new JSONArray(); contentTypeWhitelistForFilenamesOnDownload.forEach(contentTypeWhitelistForFilenamesOnDownloadJson::put); metadata.put(CONTENT_TYPE_WHITELIST_FOR_FILENAMES_ON_DOWNLOAD, contentTypeWhitelistForFilenamesOnDownloadJson); } break; default: throw new IllegalStateException("Unsupported container json version=" + currentJsonVersion); } return metadata; }

Target:
JSONObject toJson() throws JSONException { JSONObject metadata = new JSONObject(); switch (currentJsonVersion) { case JSON_VERSION_1: metadata.put(JSON_VERSION_KEY, JSON_VERSION_1); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(STATUS_KEY, status.name()); metadata.put(DESCRIPTION_KEY, description); metadata.put(IS_PRIVATE_KEY, !cacheable); metadata.put(PARENT_ACCOUNT_ID_KEY, parentAccountId); break; case JSON_VERSION_2: metadata.put(Container.JSON_VERSION_KEY, JSON_VERSION_2); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(CONTAINER_DELETE_TRIGGER_TIME_KEY, deleteTriggerTime); metadata.put(Container.STATUS_KEY, status.name()); metadata.put(DESCRIPTION_KEY, description); metadata.put(ENCRYPTED_KEY, encrypted); metadata.put(PREVIOUSLY_ENCRYPTED_KEY, previouslyEncrypted); metadata.put(CACHEABLE_KEY, cacheable); metadata.put(BACKUP_ENABLED_KEY, backupEnabled); metadata.put(MEDIA_SCAN_DISABLED_KEY, mediaScanDisabled); metadata.putOpt(REPLICATION_POLICY_KEY, replicationPolicy); metadata.put(TTL_REQUIRED_KEY, ttlRequired); metadata.put(SECURE_PATH_REQUIRED_KEY, securePathRequired); if (contentTypeWhitelistForFilenamesOnDownload != null && !contentTypeWhitelistForFilenamesOnDownload.isEmpty()) { JSONArray contentTypeWhitelistForFilenamesOnDownloadJson = new JSONArray(); contentTypeWhitelistForFilenamesOnDownload.forEach(contentTypeWhitelistForFilenamesOnDownloadJson::put); metadata.put(CONTENT_TYPE_WHITELIST_FOR_FILENAMES_ON_DOWNLOAD, contentTypeWhitelistForFilenamesOnDownloadJson); } break; default: throw new IllegalStateException("Unsupported container json version=" + currentJsonVersion); } return metadata; }