我正在尝试检索 Dropbox 元数据的标签,以便我可以将其保存在列表中并使用它来显示给定的数据是文件类型、文件夹还是被删除?
这是我使用withIncludedDeleted的方法,它允许我显示所有已删除的文件/文件夹以及未删除的文件/文件夹,如果它被删除,则显示标签。
ListFolderBuilder EntrylistFolderBuilder = getDbxCleint().files().listFolderBuilder("/data/entries");
ListFolderResult result = EntrylistFolderBuilder.withRecursive(true).withIncludeDeleted(true).start();
while (true) {
for (Metadata metadata : result.getEntries()) {
mEntries.add(metadata);
//--------//
}
if (!result.getHasMore()) {
break;
}
result = getDbxCleint().files().listFolderContinue(result.getCursor());
}
}
是否可以只从 Metadata 中检索标签?因为我不想写不同的看起来非常相似的方法,一种是包含删除,另一种是没有它,只是两个打印两个列表。
这就是存储在 mEntries ArrayList 中的元数据的样子——
{".tag":"folder","name":"entries","id":"id:NNgoZ4mypJAAAAAAAAABCw","path_lower":"/data/entries","path_display":"/data/entries"}
{".tag":"deleted","name":"entry_87e7c498a6631825dd3aa5a3c810c49a","path_lower":"/data/entries/entry_87e7c498a6631825dd3aa5a3c810c49a","path_display":"/data/entries/entry_87e7c498a6631825dd3aa5a3c810c49a"}
{".tag":"file","name":"entry_0d08beeee44681783e76de22fdfa9cb1","id":"id:NNgoZ4mypJAAAAAAAAAA_g","client_modified":"2019-03-04T10:11:44Z","server_modified":"2019-03-04T10:11:45Z","rev":"017000000012d1542b0","size":389,"path_lower":"/data/entries/entry_0d08beeee44681783e76de22fdfa9cb1","path_display":"/data/entries/entry_0d08beeee44681783e76de22fdfa9cb1","content_hash":"b05a1ceebccebd2d85520b944b56ddb7edefc7823a129a9bc116d60bbc9227a7"}
{".tag":"file","name":"entry_48b6afc3a21d255ef0cbe3ec758be441","id":"id:NNgoZ4mypJAAAAAAAAAA_w","client_modified":"2019-03-04T10:11:44Z","server_modified":"2019-03-04T10:11:45Z","rev":"018000000012d1542b0","size":2010,"path_lower":"/data/entries/entry_48b6afc3a21d255ef0cbe3ec758be441","path_display":"/data/entries/entry_48b6afc3a21d255ef0cbe3ec758be441","content_hash":"5c94187209c748e22a38926fddbbf860460e14fee1f3d76f9e81aefc446a6612"}