Skip to content

Commit

Permalink
Merge pull request square#380 from square/jw/iterable
Browse files Browse the repository at this point in the history
Generalize multiple param values to use Iterable.
  • Loading branch information
dnkoutso committed Jan 14, 2014
2 parents 04cd7e4 + 2162e82 commit 9750f00
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions retrofit/src/main/java/retrofit/RequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ void addQueryParam(String name, String value, boolean urlEncodeValue) {
}
}

void addQueryListParams(String name, List<?> values) {
void addQueryListParams(String name, Iterable<?> values) {
if (name == null) {
throw new IllegalArgumentException("Query name must not be null.");
}
if (values == null) {
throw new IllegalArgumentException("Query param list must not be null.");
throw new IllegalArgumentException("Query param values must not be null.");
}

for (Object value : values) {
Expand All @@ -180,7 +180,7 @@ void addQueryMapParams(String name, Map<?, ?> values) {
throw new IllegalArgumentException("Query name must not be null.");
}
if (values == null) {
throw new IllegalArgumentException("Query param map must not be null.");
throw new IllegalArgumentException("Query param value map must not be null.");
}

for (Map.Entry<?, ?> entry : values.entrySet()) {
Expand Down Expand Up @@ -220,8 +220,8 @@ void setArguments(Object[] args) {
break;
case QUERY:
if (value != null) { // Skip null values.
if (value instanceof List) {
addQueryListParams(name, (List<?>) value);
if (value instanceof Iterable) {
addQueryListParams(name, (Iterable<?>) value);
} else if (value instanceof Map) {
addQueryMapParams(name, (Map<?, ?>) value);
} else {
Expand Down

0 comments on commit 9750f00

Please sign in to comment.