> +                     this.page = page;
> +                     return this;
> +             }
> +
> +             public UserOptions build() {
> +                     UserOptions options = new UserOptions();
> +
> +                     if ( limit != null ) {
> +                             options.queryParameters.put("numResults", 
> String.valueOf(limit));
> +                             // Remove the "limit" parameter: it has been 
> replaced by "numResults"
> +                             limit = null;
> +                     }
> +
> +                     if ( page != null ) {
> +                             options.queryParameters.put("page", 
> String.valueOf(page));
> +                     }

You could avoid the `if` statements by simply declaring the `UserOptions` 
instance in the builder directly, and modifying that:
```
public Builder {
  private final UserOptions options = new UserOptions();

  public Builder page(int page) {
    options.queryParameters.put("page", String.valueOf(page));
    return this;
  }
  ...
  public UserOptions build() {
    return options;
  }
}
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/22/files#r5806382

Reply via email to