Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make size calculation mode more generic #1110

Open
xokker opened this issue Jul 4, 2022 · 1 comment
Open

Make size calculation mode more generic #1110

xokker opened this issue Jul 4, 2022 · 1 comment
Assignees

Comments

@xokker
Copy link
Collaborator

xokker commented Jul 4, 2022

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(); } to ContainerResource;
  • 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

@xokker xokker self-assigned this Jul 4, 2022
@Higgs32584
Copy link

Is this resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants