-
Notifications
You must be signed in to change notification settings - Fork 489
Open
Description
We need a list of downloadable items when calculating the sizes of the items stored in a container resource. Today we do it manually based on the type:
Collection<? extends DownloadableItem> items;
if (exportedData instanceof PhotosContainerResource) {
items = ((PhotosContainerResource) exportedData).getPhotos();
} else if (exportedData instanceof VideosContainerResource) {
items = ((VideosContainerResource) exportedData).getVideos();
} else {
return;
}
@jzacsh proposed to replace it with a generic approach. I like this idea, but we need to settle on the implementation.
So far I see a few options:
- introduce a method
List<DownloadableItem> getDownloadableItems() { return ImmutableList.of(); }toContainerResource; - create a new interface (along the lines of
ContainerResourceWithDownloadableItems) with the same method signature but no default implementation; - abandon the idea and keep maintaining manual if-else block.
cc @wmorland
jzacsh
Metadata
Metadata
Assignees
Labels
No labels