jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <notificati...@github.com>
Subject Re: [jclouds/jclouds-labs] Load existing machines info on startup (#355)
Date Mon, 30 Jan 2017 10:46:05 GMT
nacx commented on this pull request.

> +import com.google.common.base.Supplier;
+import com.google.common.collect.Collections2;
+import com.google.inject.Inject;
+public class ImageSupplier<B> implements Supplier<Collection<Image>>, Function<String,
Image> {
+   private final Function<Collection<B>, Collection<B>> outdatedBoxesFilter;
+   private final VagrantBoxApiFacade.Factory<B> cliFactory;
+   private final Function<B, Image> boxToImage;
+   @Inject
+   ImageSupplier(Function<Collection<B>, Collection<B>> outdatedBoxesFilter,
+         VagrantBoxApiFacade.Factory<B> cliFactory,
+         Function<B, Image> boxToImage) {
+      this.outdatedBoxesFilter = checkNotNull(outdatedBoxesFilter, "outdatedBoxesFilter");
+      this.cliFactory = checkNotNull(cliFactory, "cliFactory");
+      this.boxToImage = checkNotNull(boxToImage, "boxToImage");

Yes, Guice already fails if a value is missing so we'd better remove those null checks. I
know there are many constructors like this in the codebase but were trying to avoid the redundant
checks in all new contributions.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
View raw message