void reset() { Hashes.setValue(Collections.<String>emptyList()); Title.setValue(""); DownloadUrl.setValue(""); Mimetype.setValue(""); ThumbnailUrl.setValue(""); Size.setValue(0); }
void init(Map<String, Object> book) { if (book == null) { reset(); } else { Hashes.setValue((List<String>) book.get("all_hashes")); Title.setValue((String) book.get("title")); final String downloadUrl = (String) book.get("download_url"); DownloadUrl.setValue(downloadUrl != null ? downloadUrl : ""); final String mimetype = (String) book.get("mimetype"); Mimetype.setValue(mimetype != null ? mimetype : ""); final String thumbnailUrl = (String) book.get("thumbnail_url"); ThumbnailUrl.setValue(thumbnailUrl != null ? thumbnailUrl : ""); final Long size = (Long) book.get("size"); Size.setValue(size != null ? (int) (long) size : 0); } }