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-aws] Health check and Subnet API (#70)
Date Wed, 25 Jan 2017 10:36:06 GMT
nacx commented on this pull request.

Thanks @justinThompson! This looks great. Thanks for taking your time to add the mock tests.
Highly appreciated!

> +import com.google.common.collect.ImmutableMultimap.Builder;
+
+/**
+ * Binds the Iterable<String> to form parameters named with Subnets.member.index
+ */
+@Singleton
+public class BindSubnetIdsToIndexedFormParams implements Binder {
+   
+   @SuppressWarnings("unchecked")
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+      Iterable<?> values = Iterable.class.cast(checkNotNull(input, "subnetIds"));
+      Builder<String, String> builder = ImmutableMultimap.builder();
+      int i = 0;
+      for (Object o : values) {
+         builder.put("Subnets.member." + (i++ + 1), o.toString());

Initialize `i` to 1 to make the code easier to read?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/70#pullrequestreview-18368668
Mime
View raw message