case FM_icon: icon = JsonExtractor.StringExtractor.extractField(parser, fieldName, icon); break;
case FM_modified: modified = JsonDateExtractor.Dropbox.extractField(parser, fieldName, modified); break;
case FM_client_mtime: client_mtime = JsonDateExtractor.Dropbox.extractField(parser, fieldName, client_mtime); break;
case FM_mime_type: mime_type = JsonExtractor.StringExtractor.extractField(parser, fieldName, mime_type); break;
case FM_hash:
if (collector == null) throw new JsonExtractionException("not expecting \"hash\" field, since we didn't ask for children", parser.getCurrentLocation());
hash = JsonExtractor.StringExtractor.extractField(parser, fieldName, hash); break;
case FM_contents:
if (collector == null) throw new JsonExtractionException("not expecting \"contents\" field, since we didn't ask for children", parser.getCurrentLocation());
contents = JsonArrayExtractor.mk(Extractor, collector).extractField(parser, fieldName, contents); break;
default:
throw new AssertionError("bad index: " + fi + ", field = \"" + fieldName + "\"");
}
}
catch (JsonExtractionException ex) {
throw ex.addFieldContext(fieldName);
}
}
JsonExtractor.expectObjectEnd(parser);
if (path == null) throw new JsonExtractionException("missing field \"path\"", top);
if (icon == null) throw new JsonExtractionException("missing field \"icon\"", top);
if (is_deleted == null) is_deleted = Boolean.FALSE;
if (is_dir == null) is_dir = Boolean.FALSE;
if (thumb_exists == null) thumb_exists = Boolean.FALSE;
if (is_dir && (contents != null || hash != null)) {
if (hash == null) throw new JsonExtractionException("missing \"hash\", when we asked for children", top);
if (contents == null) throw new JsonExtractionException("missing \"contents\", when we asked for children", top);
}
DbxEntry e;
if (is_dir) {
e = new Folder(path, icon, thumb_exists);
}
else {
// Normal File
if (size == null) throw new JsonExtractionException("missing \"size\" for a file entry", top);
if (bytes == -1) throw new JsonExtractionException("missing \"bytes\" for a file entry", top);
if (modified == null) throw new JsonExtractionException("missing \"modified\" for a file entry", top);
if (client_mtime == null) throw new JsonExtractionException("missing \"client_mtime\" for a file entry", top);
if (mime_type == null) throw new JsonExtractionException("missing \"mime_type\" for a file entry", top);
if (rev == null) throw new JsonExtractionException("missing \"rev\" for a file entry", top);
e = new File(path, icon, thumb_exists, bytes, size, modified, client_mtime, mime_type, rev);
}
if (is_deleted) return null;
return new WithChildrenC<C>(e, hash, contents);